UNPKG

260 kBTypeScriptView Raw
1// tslint:disable:jsdoc-format
2// tslint:disable:no-irregular-whitespace
3
4declare namespace JQuery {
5 type TypeOrArray<T> = T | T[];
6 type Node = Element | Text | Comment | Document | DocumentFragment;
7
8 /**
9 * A string is designated htmlString in jQuery documentation when it is used to represent one or more DOM elements, typically to be created and inserted in the document. When passed as an argument of the jQuery() function, the string is identified as HTML if it starts with <tag ... >) and is parsed as such until the final > character. Prior to jQuery 1.9, a string was considered to be HTML if it contained <tag ... > anywhere within the string.
10 */
11 type htmlString = string;
12 /**
13 * A selector is used in jQuery to select DOM elements from a DOM document. That document is, in most cases, the DOM document present in all browsers, but can also be an XML document received via Ajax.
14 */
15 type Selector = string;
16
17 /**
18 * The PlainObject type is a JavaScript object containing zero or more key-value pairs. The plain object is, in other words, an Object object. It is designated "plain" in jQuery documentation to distinguish it from other kinds of JavaScript objects: for example, null, user-defined arrays, and host objects such as document, all of which have a typeof value of "object."
19 *
20 * **Note**: The type declaration of PlainObject is imprecise. It includes host objects and user-defined arrays which do not match jQuery's definition.
21 */
22 interface PlainObject<T = any> {
23 [key: string]: T;
24 }
25
26 interface Selectors extends Sizzle.Selectors {
27 /**
28 * @deprecated ​ Deprecated since 3.0. Use \`{@link Selectors#pseudos }\`.
29 *
30 * **Cause**: The standard way to add new custom selectors through jQuery is `jQuery.expr.pseudos`. These two other aliases are deprecated, although they still work as of jQuery 3.0.
31 *
32 * **Solution**: Rename any of the older usage to `jQuery.expr.pseudos`. The functionality is identical.
33 */
34 ":": Sizzle.Selectors.PseudoFunctions;
35 /**
36 * @deprecated ​ Deprecated since 3.0. Use \`{@link Selectors#pseudos }\`.
37 *
38 * **Cause**: The standard way to add new custom selectors through jQuery is `jQuery.expr.pseudos`. These two other aliases are deprecated, although they still work as of jQuery 3.0.
39 *
40 * **Solution**: Rename any of the older usage to `jQuery.expr.pseudos`. The functionality is identical.
41 */
42 filter: Sizzle.Selectors.FilterFunctions;
43 }
44
45 // region Ajax
46 // #region Ajax
47
48 interface AjaxSettings<TContext = any> extends Ajax.AjaxSettingsBase<TContext> {
49 /**
50 * A string containing the URL to which the request is sent.
51 */
52 url?: string | undefined;
53 }
54
55 interface UrlAjaxSettings<TContext = any> extends Ajax.AjaxSettingsBase<TContext> {
56 /**
57 * A string containing the URL to which the request is sent.
58 */
59 url: string;
60 }
61
62 namespace Ajax {
63 type SuccessTextStatus = "success" | "notmodified" | "nocontent";
64 type ErrorTextStatus = "timeout" | "error" | "abort" | "parsererror";
65 type TextStatus = SuccessTextStatus | ErrorTextStatus;
66
67 type SuccessCallback<TContext> = (
68 this: TContext,
69 data: any,
70 textStatus: SuccessTextStatus,
71 jqXHR: jqXHR,
72 ) => void;
73
74 type ErrorCallback<TContext> = (
75 this: TContext,
76 jqXHR: jqXHR,
77 textStatus: ErrorTextStatus,
78 errorThrown: string,
79 ) => void;
80
81 type CompleteCallback<TContext> = (this: TContext, jqXHR: jqXHR, textStatus: TextStatus) => void;
82
83 /**
84 * @see \`{@link https://api.jquery.com/jquery.ajax/#jQuery-ajax-settings }\`
85 */
86 interface AjaxSettingsBase<TContext> {
87 /**
88 * A set of key/value pairs that map a given dataType to its MIME type, which gets sent in the Accept request header. This header tells the server what kind of response it will accept in return.
89 */
90 accepts?: PlainObject<string> | undefined;
91 /**
92 * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done().
93 */
94 async?: boolean | undefined;
95 /**
96 * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request.
97 */
98 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
99 beforeSend?(this: TContext, jqXHR: jqXHR, settings: this): false | void;
100 /**
101 * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.
102 */
103 cache?: boolean | undefined;
104 /**
105 * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "nocontent", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
106 */
107 complete?: TypeOrArray<CompleteCallback<TContext>> | undefined;
108 /**
109 * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type.
110 */
111 contents?: PlainObject<RegExp> | undefined;
112 /**
113 * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). As of jQuery 1.6 you can pass false to tell jQuery to not set any content type header. Note: The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. Note: For cross-domain requests, setting the content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or text/plain will trigger the browser to send a preflight OPTIONS request to the server.
114 */
115 contentType?: string | false | undefined;
116 /**
117 * This object will be the context of all Ajax-related callbacks. By default, the context is an object that represents the Ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax).
118 */
119 context?: TContext | undefined;
120 /**
121 * An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response.
122 */
123 converters?: PlainObject<((value: any) => any) | true> | undefined;
124 /**
125 * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain.
126 */
127 crossDomain?: boolean | undefined;
128 /**
129 * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
130 */
131 data?: PlainObject | string | undefined;
132 /**
133 * A function to be used to handle the raw response data of XMLHttpRequest. This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter.
134 */
135 dataFilter?(data: string, type: string): any;
136 /**
137 * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). The available types (and the result passed as the first argument to your success callback) are:
138 *
139 * "xml": Returns a XML document that can be processed via jQuery.
140 *
141 * "html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM.
142 *
143 * "script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, _=[TIMESTAMP], to the URL unless the cache option is set to true. Note: This will turn POSTs into GETs for remote-domain requests.
144 *
145 * "json": Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json" requests are converted to "jsonp" unless the request includes jsonp: false in its request options. The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of jQuery 1.9, an empty response is also rejected; the server should return a response of null or {} instead. (See json.org for more information on proper JSON formatting.)
146 *
147 * "jsonp": Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to the URL unless the cache option is set to true.
148 *
149 * "text": A plain text string.
150 *
151 * multiple, space-separated values: As of jQuery 1.5, jQuery can convert a dataType from what it received in the Content-Type header to what you require. For example, if you want a text response to be treated as XML, use "text xml" for the dataType. You can also make a JSONP request, have it received as text, and interpreted by jQuery as XML: "jsonp text xml". Similarly, a shorthand string such as "jsonp xml" will first attempt to convert from jsonp to xml, and, failing that, convert from jsonp to text, and then from text to xml.
152 */
153 dataType?: "xml" | "html" | "script" | "json" | "jsonp" | "text" | string | undefined;
154 /**
155 * The MIME type of content that is used to submit the form to the server. Possible values are:
156 *
157 * "application/x-www-form-urlencoded": The initial default type.
158 *
159 * "multipart/form-data": The type that allows file <input> element(s) to upload file data.
160 *
161 * "text/plain": A type introduced in HTML5.
162 */
163 enctype?: "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain" | undefined;
164 /**
165 * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
166 */
167 error?: TypeOrArray<ErrorCallback<TContext>> | undefined;
168 /**
169 * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events.
170 */
171 global?: boolean | undefined;
172 /**
173 * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function.
174 */
175 headers?: PlainObject<string | null | undefined> | undefined;
176 /**
177 * Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data.
178 */
179 ifModified?: boolean | undefined;
180 /**
181 * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method.
182 */
183 isLocal?: boolean | undefined;
184 /**
185 * Override the callback function name in a JSONP request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" }. If you don't trust the target of your Ajax requests, consider setting the jsonp property to false for security reasons.
186 */
187 jsonp?: string | false | undefined;
188 /**
189 * Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function.
190 */
191 jsonpCallback?: string | ((this: TContext) => string) | undefined;
192 /**
193 * The HTTP method to use for the request (e.g. "POST", "GET", "PUT").
194 */
195 method?: string | undefined;
196 /**
197 * A mime type to override the XHR mime type.
198 */
199 mimeType?: string | undefined;
200 /**
201 * A password to be used with XMLHttpRequest in response to an HTTP access authentication request.
202 */
203 password?: string | undefined;
204 /**
205 * By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false.
206 */
207 processData?: boolean | undefined;
208 /**
209 * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script.
210 */
211 scriptCharset?: string | undefined;
212 /**
213 * An object of numeric HTTP codes and functions to be called when the response has the corresponding code.
214 *
215 * If the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback.
216 */
217 statusCode?: StatusCodeCallbacks<TContext> | undefined;
218 /**
219 * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter or the dataFilter callback function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
220 */
221 success?: TypeOrArray<SuccessCallback<TContext>> | undefined;
222 /**
223 * Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period.
224 */
225 timeout?: number | undefined;
226 /**
227 * Set this to true if you wish to use the traditional style of param serialization.
228 */
229 traditional?: boolean | undefined;
230 /**
231 * An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0.
232 */
233 type?: string | undefined;
234 /**
235 * A username to be used with XMLHttpRequest in response to an HTTP access authentication request.
236 */
237 username?: string | undefined;
238 // ActiveXObject requires "lib": ["scripthost"] which consumers would also require
239 /**
240 * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory.
241 */
242 xhr?(): XMLHttpRequest;
243 /**
244 * An object of fieldName-fieldValue pairs to set on the native XHR object.
245 *
246 * In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it.
247 */
248 xhrFields?: XHRFields | undefined;
249 }
250
251 // region StatusCodeCallbacks
252 // #region StatusCodeCallbacks
253
254 type StatusCodeCallbacks<TContext> = {
255 // region Success Status Codes
256 // #region Success Status Codes
257
258 // jQuery treats 2xx and 304 status codes as a success
259
260 200?: SuccessCallback<TContext> | undefined;
261 201?: SuccessCallback<TContext> | undefined;
262 202?: SuccessCallback<TContext> | undefined;
263 203?: SuccessCallback<TContext> | undefined;
264 204?: SuccessCallback<TContext> | undefined;
265 205?: SuccessCallback<TContext> | undefined;
266 206?: SuccessCallback<TContext> | undefined;
267 207?: SuccessCallback<TContext> | undefined;
268 208?: SuccessCallback<TContext> | undefined;
269 209?: SuccessCallback<TContext> | undefined;
270 210?: SuccessCallback<TContext> | undefined;
271 211?: SuccessCallback<TContext> | undefined;
272 212?: SuccessCallback<TContext> | undefined;
273 213?: SuccessCallback<TContext> | undefined;
274 214?: SuccessCallback<TContext> | undefined;
275 215?: SuccessCallback<TContext> | undefined;
276 216?: SuccessCallback<TContext> | undefined;
277 217?: SuccessCallback<TContext> | undefined;
278 218?: SuccessCallback<TContext> | undefined;
279 219?: SuccessCallback<TContext> | undefined;
280 220?: SuccessCallback<TContext> | undefined;
281 221?: SuccessCallback<TContext> | undefined;
282 222?: SuccessCallback<TContext> | undefined;
283 223?: SuccessCallback<TContext> | undefined;
284 224?: SuccessCallback<TContext> | undefined;
285 225?: SuccessCallback<TContext> | undefined;
286 226?: SuccessCallback<TContext> | undefined;
287 227?: SuccessCallback<TContext> | undefined;
288 228?: SuccessCallback<TContext> | undefined;
289 229?: SuccessCallback<TContext> | undefined;
290 230?: SuccessCallback<TContext> | undefined;
291 231?: SuccessCallback<TContext> | undefined;
292 232?: SuccessCallback<TContext> | undefined;
293 233?: SuccessCallback<TContext> | undefined;
294 234?: SuccessCallback<TContext> | undefined;
295 235?: SuccessCallback<TContext> | undefined;
296 236?: SuccessCallback<TContext> | undefined;
297 237?: SuccessCallback<TContext> | undefined;
298 238?: SuccessCallback<TContext> | undefined;
299 239?: SuccessCallback<TContext> | undefined;
300 240?: SuccessCallback<TContext> | undefined;
301 241?: SuccessCallback<TContext> | undefined;
302 242?: SuccessCallback<TContext> | undefined;
303 243?: SuccessCallback<TContext> | undefined;
304 244?: SuccessCallback<TContext> | undefined;
305 245?: SuccessCallback<TContext> | undefined;
306 246?: SuccessCallback<TContext> | undefined;
307 247?: SuccessCallback<TContext> | undefined;
308 248?: SuccessCallback<TContext> | undefined;
309 249?: SuccessCallback<TContext> | undefined;
310 250?: SuccessCallback<TContext> | undefined;
311 251?: SuccessCallback<TContext> | undefined;
312 252?: SuccessCallback<TContext> | undefined;
313 253?: SuccessCallback<TContext> | undefined;
314 254?: SuccessCallback<TContext> | undefined;
315 255?: SuccessCallback<TContext> | undefined;
316 256?: SuccessCallback<TContext> | undefined;
317 257?: SuccessCallback<TContext> | undefined;
318 258?: SuccessCallback<TContext> | undefined;
319 259?: SuccessCallback<TContext> | undefined;
320 260?: SuccessCallback<TContext> | undefined;
321 261?: SuccessCallback<TContext> | undefined;
322 262?: SuccessCallback<TContext> | undefined;
323 263?: SuccessCallback<TContext> | undefined;
324 264?: SuccessCallback<TContext> | undefined;
325 265?: SuccessCallback<TContext> | undefined;
326 266?: SuccessCallback<TContext> | undefined;
327 267?: SuccessCallback<TContext> | undefined;
328 268?: SuccessCallback<TContext> | undefined;
329 269?: SuccessCallback<TContext> | undefined;
330 270?: SuccessCallback<TContext> | undefined;
331 271?: SuccessCallback<TContext> | undefined;
332 272?: SuccessCallback<TContext> | undefined;
333 273?: SuccessCallback<TContext> | undefined;
334 274?: SuccessCallback<TContext> | undefined;
335 275?: SuccessCallback<TContext> | undefined;
336 276?: SuccessCallback<TContext> | undefined;
337 277?: SuccessCallback<TContext> | undefined;
338 278?: SuccessCallback<TContext> | undefined;
339 279?: SuccessCallback<TContext> | undefined;
340 280?: SuccessCallback<TContext> | undefined;
341 281?: SuccessCallback<TContext> | undefined;
342 282?: SuccessCallback<TContext> | undefined;
343 283?: SuccessCallback<TContext> | undefined;
344 284?: SuccessCallback<TContext> | undefined;
345 285?: SuccessCallback<TContext> | undefined;
346 286?: SuccessCallback<TContext> | undefined;
347 287?: SuccessCallback<TContext> | undefined;
348 288?: SuccessCallback<TContext> | undefined;
349 289?: SuccessCallback<TContext> | undefined;
350 290?: SuccessCallback<TContext> | undefined;
351 291?: SuccessCallback<TContext> | undefined;
352 292?: SuccessCallback<TContext> | undefined;
353 293?: SuccessCallback<TContext> | undefined;
354 294?: SuccessCallback<TContext> | undefined;
355 295?: SuccessCallback<TContext> | undefined;
356 296?: SuccessCallback<TContext> | undefined;
357 297?: SuccessCallback<TContext> | undefined;
358 298?: SuccessCallback<TContext> | undefined;
359 299?: SuccessCallback<TContext> | undefined;
360 304?: SuccessCallback<TContext> | undefined;
361
362 // #endregion
363
364 // region Error Status Codes
365 // #region Error Status Codes
366
367 300?: ErrorCallback<TContext> | undefined;
368 301?: ErrorCallback<TContext> | undefined;
369 302?: ErrorCallback<TContext> | undefined;
370 303?: ErrorCallback<TContext> | undefined;
371 305?: ErrorCallback<TContext> | undefined;
372 306?: ErrorCallback<TContext> | undefined;
373 307?: ErrorCallback<TContext> | undefined;
374 308?: ErrorCallback<TContext> | undefined;
375 309?: ErrorCallback<TContext> | undefined;
376 310?: ErrorCallback<TContext> | undefined;
377 311?: ErrorCallback<TContext> | undefined;
378 312?: ErrorCallback<TContext> | undefined;
379 313?: ErrorCallback<TContext> | undefined;
380 314?: ErrorCallback<TContext> | undefined;
381 315?: ErrorCallback<TContext> | undefined;
382 316?: ErrorCallback<TContext> | undefined;
383 317?: ErrorCallback<TContext> | undefined;
384 318?: ErrorCallback<TContext> | undefined;
385 319?: ErrorCallback<TContext> | undefined;
386 320?: ErrorCallback<TContext> | undefined;
387 321?: ErrorCallback<TContext> | undefined;
388 322?: ErrorCallback<TContext> | undefined;
389 323?: ErrorCallback<TContext> | undefined;
390 324?: ErrorCallback<TContext> | undefined;
391 325?: ErrorCallback<TContext> | undefined;
392 326?: ErrorCallback<TContext> | undefined;
393 327?: ErrorCallback<TContext> | undefined;
394 328?: ErrorCallback<TContext> | undefined;
395 329?: ErrorCallback<TContext> | undefined;
396 330?: ErrorCallback<TContext> | undefined;
397 331?: ErrorCallback<TContext> | undefined;
398 332?: ErrorCallback<TContext> | undefined;
399 333?: ErrorCallback<TContext> | undefined;
400 334?: ErrorCallback<TContext> | undefined;
401 335?: ErrorCallback<TContext> | undefined;
402 336?: ErrorCallback<TContext> | undefined;
403 337?: ErrorCallback<TContext> | undefined;
404 338?: ErrorCallback<TContext> | undefined;
405 339?: ErrorCallback<TContext> | undefined;
406 340?: ErrorCallback<TContext> | undefined;
407 341?: ErrorCallback<TContext> | undefined;
408 342?: ErrorCallback<TContext> | undefined;
409 343?: ErrorCallback<TContext> | undefined;
410 344?: ErrorCallback<TContext> | undefined;
411 345?: ErrorCallback<TContext> | undefined;
412 346?: ErrorCallback<TContext> | undefined;
413 347?: ErrorCallback<TContext> | undefined;
414 348?: ErrorCallback<TContext> | undefined;
415 349?: ErrorCallback<TContext> | undefined;
416 350?: ErrorCallback<TContext> | undefined;
417 351?: ErrorCallback<TContext> | undefined;
418 352?: ErrorCallback<TContext> | undefined;
419 353?: ErrorCallback<TContext> | undefined;
420 354?: ErrorCallback<TContext> | undefined;
421 355?: ErrorCallback<TContext> | undefined;
422 356?: ErrorCallback<TContext> | undefined;
423 357?: ErrorCallback<TContext> | undefined;
424 358?: ErrorCallback<TContext> | undefined;
425 359?: ErrorCallback<TContext> | undefined;
426 360?: ErrorCallback<TContext> | undefined;
427 361?: ErrorCallback<TContext> | undefined;
428 362?: ErrorCallback<TContext> | undefined;
429 363?: ErrorCallback<TContext> | undefined;
430 364?: ErrorCallback<TContext> | undefined;
431 365?: ErrorCallback<TContext> | undefined;
432 366?: ErrorCallback<TContext> | undefined;
433 367?: ErrorCallback<TContext> | undefined;
434 368?: ErrorCallback<TContext> | undefined;
435 369?: ErrorCallback<TContext> | undefined;
436 370?: ErrorCallback<TContext> | undefined;
437 371?: ErrorCallback<TContext> | undefined;
438 372?: ErrorCallback<TContext> | undefined;
439 373?: ErrorCallback<TContext> | undefined;
440 374?: ErrorCallback<TContext> | undefined;
441 375?: ErrorCallback<TContext> | undefined;
442 376?: ErrorCallback<TContext> | undefined;
443 377?: ErrorCallback<TContext> | undefined;
444 378?: ErrorCallback<TContext> | undefined;
445 379?: ErrorCallback<TContext> | undefined;
446 380?: ErrorCallback<TContext> | undefined;
447 381?: ErrorCallback<TContext> | undefined;
448 382?: ErrorCallback<TContext> | undefined;
449 383?: ErrorCallback<TContext> | undefined;
450 384?: ErrorCallback<TContext> | undefined;
451 385?: ErrorCallback<TContext> | undefined;
452 386?: ErrorCallback<TContext> | undefined;
453 387?: ErrorCallback<TContext> | undefined;
454 388?: ErrorCallback<TContext> | undefined;
455 389?: ErrorCallback<TContext> | undefined;
456 390?: ErrorCallback<TContext> | undefined;
457 391?: ErrorCallback<TContext> | undefined;
458 392?: ErrorCallback<TContext> | undefined;
459 393?: ErrorCallback<TContext> | undefined;
460 394?: ErrorCallback<TContext> | undefined;
461 395?: ErrorCallback<TContext> | undefined;
462 396?: ErrorCallback<TContext> | undefined;
463 397?: ErrorCallback<TContext> | undefined;
464 398?: ErrorCallback<TContext> | undefined;
465 399?: ErrorCallback<TContext> | undefined;
466 400?: ErrorCallback<TContext> | undefined;
467 401?: ErrorCallback<TContext> | undefined;
468 402?: ErrorCallback<TContext> | undefined;
469 403?: ErrorCallback<TContext> | undefined;
470 404?: ErrorCallback<TContext> | undefined;
471 405?: ErrorCallback<TContext> | undefined;
472 406?: ErrorCallback<TContext> | undefined;
473 407?: ErrorCallback<TContext> | undefined;
474 408?: ErrorCallback<TContext> | undefined;
475 409?: ErrorCallback<TContext> | undefined;
476 410?: ErrorCallback<TContext> | undefined;
477 411?: ErrorCallback<TContext> | undefined;
478 412?: ErrorCallback<TContext> | undefined;
479 413?: ErrorCallback<TContext> | undefined;
480 414?: ErrorCallback<TContext> | undefined;
481 415?: ErrorCallback<TContext> | undefined;
482 416?: ErrorCallback<TContext> | undefined;
483 417?: ErrorCallback<TContext> | undefined;
484 418?: ErrorCallback<TContext> | undefined;
485 419?: ErrorCallback<TContext> | undefined;
486 420?: ErrorCallback<TContext> | undefined;
487 421?: ErrorCallback<TContext> | undefined;
488 422?: ErrorCallback<TContext> | undefined;
489 423?: ErrorCallback<TContext> | undefined;
490 424?: ErrorCallback<TContext> | undefined;
491 425?: ErrorCallback<TContext> | undefined;
492 426?: ErrorCallback<TContext> | undefined;
493 427?: ErrorCallback<TContext> | undefined;
494 428?: ErrorCallback<TContext> | undefined;
495 429?: ErrorCallback<TContext> | undefined;
496 430?: ErrorCallback<TContext> | undefined;
497 431?: ErrorCallback<TContext> | undefined;
498 432?: ErrorCallback<TContext> | undefined;
499 433?: ErrorCallback<TContext> | undefined;
500 434?: ErrorCallback<TContext> | undefined;
501 435?: ErrorCallback<TContext> | undefined;
502 436?: ErrorCallback<TContext> | undefined;
503 437?: ErrorCallback<TContext> | undefined;
504 438?: ErrorCallback<TContext> | undefined;
505 439?: ErrorCallback<TContext> | undefined;
506 440?: ErrorCallback<TContext> | undefined;
507 441?: ErrorCallback<TContext> | undefined;
508 442?: ErrorCallback<TContext> | undefined;
509 443?: ErrorCallback<TContext> | undefined;
510 444?: ErrorCallback<TContext> | undefined;
511 445?: ErrorCallback<TContext> | undefined;
512 446?: ErrorCallback<TContext> | undefined;
513 447?: ErrorCallback<TContext> | undefined;
514 448?: ErrorCallback<TContext> | undefined;
515 449?: ErrorCallback<TContext> | undefined;
516 450?: ErrorCallback<TContext> | undefined;
517 451?: ErrorCallback<TContext> | undefined;
518 452?: ErrorCallback<TContext> | undefined;
519 453?: ErrorCallback<TContext> | undefined;
520 454?: ErrorCallback<TContext> | undefined;
521 455?: ErrorCallback<TContext> | undefined;
522 456?: ErrorCallback<TContext> | undefined;
523 457?: ErrorCallback<TContext> | undefined;
524 458?: ErrorCallback<TContext> | undefined;
525 459?: ErrorCallback<TContext> | undefined;
526 460?: ErrorCallback<TContext> | undefined;
527 461?: ErrorCallback<TContext> | undefined;
528 462?: ErrorCallback<TContext> | undefined;
529 463?: ErrorCallback<TContext> | undefined;
530 464?: ErrorCallback<TContext> | undefined;
531 465?: ErrorCallback<TContext> | undefined;
532 466?: ErrorCallback<TContext> | undefined;
533 467?: ErrorCallback<TContext> | undefined;
534 468?: ErrorCallback<TContext> | undefined;
535 469?: ErrorCallback<TContext> | undefined;
536 470?: ErrorCallback<TContext> | undefined;
537 471?: ErrorCallback<TContext> | undefined;
538 472?: ErrorCallback<TContext> | undefined;
539 473?: ErrorCallback<TContext> | undefined;
540 474?: ErrorCallback<TContext> | undefined;
541 475?: ErrorCallback<TContext> | undefined;
542 476?: ErrorCallback<TContext> | undefined;
543 477?: ErrorCallback<TContext> | undefined;
544 478?: ErrorCallback<TContext> | undefined;
545 479?: ErrorCallback<TContext> | undefined;
546 480?: ErrorCallback<TContext> | undefined;
547 481?: ErrorCallback<TContext> | undefined;
548 482?: ErrorCallback<TContext> | undefined;
549 483?: ErrorCallback<TContext> | undefined;
550 484?: ErrorCallback<TContext> | undefined;
551 485?: ErrorCallback<TContext> | undefined;
552 486?: ErrorCallback<TContext> | undefined;
553 487?: ErrorCallback<TContext> | undefined;
554 488?: ErrorCallback<TContext> | undefined;
555 489?: ErrorCallback<TContext> | undefined;
556 490?: ErrorCallback<TContext> | undefined;
557 491?: ErrorCallback<TContext> | undefined;
558 492?: ErrorCallback<TContext> | undefined;
559 493?: ErrorCallback<TContext> | undefined;
560 494?: ErrorCallback<TContext> | undefined;
561 495?: ErrorCallback<TContext> | undefined;
562 496?: ErrorCallback<TContext> | undefined;
563 497?: ErrorCallback<TContext> | undefined;
564 498?: ErrorCallback<TContext> | undefined;
565 499?: ErrorCallback<TContext> | undefined;
566 500?: ErrorCallback<TContext> | undefined;
567 501?: ErrorCallback<TContext> | undefined;
568 502?: ErrorCallback<TContext> | undefined;
569 503?: ErrorCallback<TContext> | undefined;
570 504?: ErrorCallback<TContext> | undefined;
571 505?: ErrorCallback<TContext> | undefined;
572 506?: ErrorCallback<TContext> | undefined;
573 507?: ErrorCallback<TContext> | undefined;
574 508?: ErrorCallback<TContext> | undefined;
575 509?: ErrorCallback<TContext> | undefined;
576 510?: ErrorCallback<TContext> | undefined;
577 511?: ErrorCallback<TContext> | undefined;
578 512?: ErrorCallback<TContext> | undefined;
579 513?: ErrorCallback<TContext> | undefined;
580 514?: ErrorCallback<TContext> | undefined;
581 515?: ErrorCallback<TContext> | undefined;
582 516?: ErrorCallback<TContext> | undefined;
583 517?: ErrorCallback<TContext> | undefined;
584 518?: ErrorCallback<TContext> | undefined;
585 519?: ErrorCallback<TContext> | undefined;
586 520?: ErrorCallback<TContext> | undefined;
587 521?: ErrorCallback<TContext> | undefined;
588 522?: ErrorCallback<TContext> | undefined;
589 523?: ErrorCallback<TContext> | undefined;
590 524?: ErrorCallback<TContext> | undefined;
591 525?: ErrorCallback<TContext> | undefined;
592 526?: ErrorCallback<TContext> | undefined;
593 527?: ErrorCallback<TContext> | undefined;
594 528?: ErrorCallback<TContext> | undefined;
595 529?: ErrorCallback<TContext> | undefined;
596 530?: ErrorCallback<TContext> | undefined;
597 531?: ErrorCallback<TContext> | undefined;
598 532?: ErrorCallback<TContext> | undefined;
599 533?: ErrorCallback<TContext> | undefined;
600 534?: ErrorCallback<TContext> | undefined;
601 535?: ErrorCallback<TContext> | undefined;
602 536?: ErrorCallback<TContext> | undefined;
603 537?: ErrorCallback<TContext> | undefined;
604 538?: ErrorCallback<TContext> | undefined;
605 539?: ErrorCallback<TContext> | undefined;
606 540?: ErrorCallback<TContext> | undefined;
607 541?: ErrorCallback<TContext> | undefined;
608 542?: ErrorCallback<TContext> | undefined;
609 543?: ErrorCallback<TContext> | undefined;
610 544?: ErrorCallback<TContext> | undefined;
611 545?: ErrorCallback<TContext> | undefined;
612 546?: ErrorCallback<TContext> | undefined;
613 547?: ErrorCallback<TContext> | undefined;
614 548?: ErrorCallback<TContext> | undefined;
615 549?: ErrorCallback<TContext> | undefined;
616 550?: ErrorCallback<TContext> | undefined;
617 551?: ErrorCallback<TContext> | undefined;
618 552?: ErrorCallback<TContext> | undefined;
619 553?: ErrorCallback<TContext> | undefined;
620 554?: ErrorCallback<TContext> | undefined;
621 555?: ErrorCallback<TContext> | undefined;
622 556?: ErrorCallback<TContext> | undefined;
623 557?: ErrorCallback<TContext> | undefined;
624 558?: ErrorCallback<TContext> | undefined;
625 559?: ErrorCallback<TContext> | undefined;
626 560?: ErrorCallback<TContext> | undefined;
627 561?: ErrorCallback<TContext> | undefined;
628 562?: ErrorCallback<TContext> | undefined;
629 563?: ErrorCallback<TContext> | undefined;
630 564?: ErrorCallback<TContext> | undefined;
631 565?: ErrorCallback<TContext> | undefined;
632 566?: ErrorCallback<TContext> | undefined;
633 567?: ErrorCallback<TContext> | undefined;
634 568?: ErrorCallback<TContext> | undefined;
635 569?: ErrorCallback<TContext> | undefined;
636 570?: ErrorCallback<TContext> | undefined;
637 571?: ErrorCallback<TContext> | undefined;
638 572?: ErrorCallback<TContext> | undefined;
639 573?: ErrorCallback<TContext> | undefined;
640 574?: ErrorCallback<TContext> | undefined;
641 575?: ErrorCallback<TContext> | undefined;
642 576?: ErrorCallback<TContext> | undefined;
643 577?: ErrorCallback<TContext> | undefined;
644 578?: ErrorCallback<TContext> | undefined;
645 579?: ErrorCallback<TContext> | undefined;
646 580?: ErrorCallback<TContext> | undefined;
647 581?: ErrorCallback<TContext> | undefined;
648 582?: ErrorCallback<TContext> | undefined;
649 583?: ErrorCallback<TContext> | undefined;
650 584?: ErrorCallback<TContext> | undefined;
651 585?: ErrorCallback<TContext> | undefined;
652 586?: ErrorCallback<TContext> | undefined;
653 587?: ErrorCallback<TContext> | undefined;
654 588?: ErrorCallback<TContext> | undefined;
655 589?: ErrorCallback<TContext> | undefined;
656 590?: ErrorCallback<TContext> | undefined;
657 591?: ErrorCallback<TContext> | undefined;
658 592?: ErrorCallback<TContext> | undefined;
659 593?: ErrorCallback<TContext> | undefined;
660 594?: ErrorCallback<TContext> | undefined;
661 595?: ErrorCallback<TContext> | undefined;
662 596?: ErrorCallback<TContext> | undefined;
663 597?: ErrorCallback<TContext> | undefined;
664 598?: ErrorCallback<TContext> | undefined;
665 599?: ErrorCallback<TContext> | undefined;
666 // #endregion
667 } & {
668 // Status codes not listed require type annotations when defining the callback
669 [index: number]: SuccessCallback<TContext> | ErrorCallback<TContext>;
670 };
671
672 // #endregion
673
674 // Writable properties on XMLHttpRequest
675 interface XHRFields
676 extends Partial<Pick<XMLHttpRequest, "onreadystatechange" | "responseType" | "timeout" | "withCredentials">>
677 {
678 msCaching?: string | undefined;
679 }
680 }
681
682 interface Transport {
683 send(headers: PlainObject, completeCallback: Transport.SuccessCallback): void;
684 abort(): void;
685 }
686
687 namespace Transport {
688 type SuccessCallback = (
689 status: number,
690 statusText: Ajax.TextStatus,
691 responses?: PlainObject,
692 headers?: string,
693 ) => void;
694 }
695
696 /**
697 * @see \`{@link https://api.jquery.com/jquery.ajax/#jqXHR }\`
698 */
699 interface jqXHR<TResolve = any> extends
700 Promise3<
701 TResolve,
702 jqXHR<TResolve>,
703 never,
704 Ajax.SuccessTextStatus,
705 Ajax.ErrorTextStatus,
706 never,
707 jqXHR<TResolve>,
708 string,
709 never
710 >,
711 Pick<
712 XMLHttpRequest,
713 | "abort"
714 | "getAllResponseHeaders"
715 | "getResponseHeader"
716 | "overrideMimeType"
717 | "readyState"
718 | "responseText"
719 | "setRequestHeader"
720 | "status"
721 | "statusText"
722 >,
723 Partial<Pick<XMLHttpRequest, "responseXML">>
724 {
725 responseJSON?: any;
726 abort(statusText?: string): void;
727
728 /**
729 * Determine the current state of a Deferred object.
730 * @see \`{@link https://api.jquery.com/deferred.state/ }\`
731 * @since 1.7
732 */
733 state(): "pending" | "resolved" | "rejected";
734 statusCode(map: Ajax.StatusCodeCallbacks<any>): void;
735 }
736
737 namespace jqXHR {
738 interface DoneCallback<TResolve = any, TjqXHR = jqXHR<TResolve>>
739 extends Deferred.Callback3<TResolve, Ajax.SuccessTextStatus, TjqXHR>
740 {}
741
742 interface FailCallback<TjqXHR> extends Deferred.Callback3<TjqXHR, Ajax.ErrorTextStatus, string> {}
743
744 interface AlwaysCallback<TResolve = any, TjqXHR = jqXHR<TResolve>>
745 extends Deferred.Callback3<TResolve | TjqXHR, Ajax.TextStatus, TjqXHR | string>
746 {}
747 }
748
749 // #endregion
750
751 // region Callbacks
752 // #region Callbacks
753
754 interface CallbacksStatic {
755 /**
756 * A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
757 * @param flags An optional list of space-separated flags that change how the callback list behaves.
758 * @see \`{@link https://api.jquery.com/jQuery.Callbacks/ }\`
759 * @since 1.7
760 */
761 /* eslint-disable @definitelytyped/no-unnecessary-generics */
762 // eslint-disable-next-line @typescript-eslint/ban-types
763 <T extends Function>(flags?: string): Callbacks<T>;
764 /* eslint-enable @definitelytyped/no-unnecessary-generics */
765 }
766
767 // eslint-disable-next-line @typescript-eslint/ban-types
768 interface Callbacks<T extends Function = Function> {
769 /**
770 * Add a callback or a collection of callbacks to a callback list.
771 * @param callback A function, or array of functions, that are to be added to the callback list.
772 * @param callbacks A function, or array of functions, that are to be added to the callback list.
773 * @see \`{@link https://api.jquery.com/callbacks.add/ }\`
774 * @since 1.7
775 * @example ​ ````Use callbacks.add() to add new callbacks to a callback list:
776```javascript
777// A sample logging function to be added to a callbacks list
778var foo = function( value ) {
779 console.log( "foo: " + value );
780};
781
782// Another function to also be added to the list
783var bar = function( value ) {
784 console.log( "bar: " + value );
785};
786
787var callbacks = $.Callbacks();
788
789// Add the function "foo" to the list
790callbacks.add( foo );
791
792// Fire the items on the list
793callbacks.fire( "hello" );
794// Outputs: "foo: hello"
795
796// Add the function "bar" to the list
797callbacks.add( bar );
798
799// Fire the items on the list again
800callbacks.fire( "world" );
801
802// Outputs:
803// "foo: world"
804// "bar: world"
805```
806 */
807 add(callback: TypeOrArray<T>, ...callbacks: Array<TypeOrArray<T>>): this;
808 /**
809 * Disable a callback list from doing anything more.
810 * @see \`{@link https://api.jquery.com/callbacks.disable/ }\`
811 * @since 1.7
812 * @example ​ ````Use callbacks.disable() to disable further calls to a callback list:
813```javascript
814// A sample logging function to be added to a callbacks list
815var foo = function( value ) {
816 console.log( value );
817};
818
819var callbacks = $.Callbacks();
820
821// Add the above function to the list
822callbacks.add( foo );
823
824// Fire the items on the list
825callbacks.fire( "foo" );
826// Outputs: foo
827
828// Disable further calls being possible
829callbacks.disable();
830
831// Attempt to fire with "foobar" as an argument
832callbacks.fire( "foobar" );
833// foobar isn't output
834```
835 */
836 disable(): this;
837 /**
838 * Determine if the callbacks list has been disabled.
839 * @see \`{@link https://api.jquery.com/callbacks.disabled/ }\`
840 * @since 1.7
841 * @example ​ ````Use callbacks.disabled() to determine if the callbacks list has been disabled:
842```javascript
843// A sample logging function to be added to a callbacks list
844var foo = function( value ) {
845 console.log( "foo:" + value );
846};
847
848var callbacks = $.Callbacks();
849
850// Add the logging function to the callback list
851callbacks.add( foo );
852
853// Fire the items on the list, passing an argument
854callbacks.fire( "hello" );
855// Outputs "foo: hello"
856
857// Disable the callbacks list
858callbacks.disable();
859
860// Test the disabled state of the list
861console.log ( callbacks.disabled() );
862// Outputs: true
863```
864 */
865 disabled(): boolean;
866 /**
867 * Remove all of the callbacks from a list.
868 * @see \`{@link https://api.jquery.com/callbacks.empty/ }\`
869 * @since 1.7
870 * @example ​ ````Use callbacks.empty() to empty a list of callbacks:
871```javascript
872// A sample logging function to be added to a callbacks list
873var foo = function( value1, value2 ) {
874 console.log( "foo: " + value1 + "," + value2 );
875};
876
877// Another function to also be added to the list
878var bar = function( value1, value2 ) {
879 console.log( "bar: " + value1 + "," + value2 );
880};
881
882var callbacks = $.Callbacks();
883
884// Add the two functions
885callbacks.add( foo );
886callbacks.add( bar );
887
888// Empty the callbacks list
889callbacks.empty();
890
891// Check to ensure all callbacks have been removed
892console.log( callbacks.has( foo ) );
893// false
894console.log( callbacks.has( bar ) );
895// false
896```
897 */
898 empty(): this;
899 /**
900 * Call all of the callbacks with the given arguments.
901 * @param args The argument or list of arguments to pass back to the callback list.
902 * @see \`{@link https://api.jquery.com/callbacks.fire/ }\`
903 * @since 1.7
904 * @example ​ ````Use callbacks.fire() to invoke the callbacks in a list with any arguments that have been passed:
905```javascript
906// A sample logging function to be added to a callbacks list
907var foo = function( value ) {
908 console.log( "foo:" + value );
909};
910
911var callbacks = $.Callbacks();
912
913// Add the function "foo" to the list
914callbacks.add( foo );
915
916// Fire the items on the list
917callbacks.fire( "hello" ); // Outputs: "foo: hello"
918callbacks.fire( "world" ); // Outputs: "foo: world"
919
920// Add another function to the list
921var bar = function( value ){
922 console.log( "bar:" + value );
923};
924
925// Add this function to the list
926callbacks.add( bar );
927
928// Fire the items on the list again
929callbacks.fire( "hello again" );
930// Outputs:
931// "foo: hello again"
932// "bar: hello again"
933```
934 */
935 fire(...args: any[]): this;
936 /**
937 * Determine if the callbacks have already been called at least once.
938 * @see \`{@link https://api.jquery.com/callbacks.fired/ }\`
939 * @since 1.7
940 * @example ​ ````Use callbacks.fired() to determine if the callbacks in a list have been called at least once:
941```javascript
942// A sample logging function to be added to a callbacks list
943var foo = function( value ) {
944 console.log( "foo:" + value );
945};
946
947var callbacks = $.Callbacks();
948
949// Add the function "foo" to the list
950callbacks.add( foo );
951
952// Fire the items on the list
953callbacks.fire( "hello" ); // Outputs: "foo: hello"
954callbacks.fire( "world" ); // Outputs: "foo: world"
955
956// Test to establish if the callbacks have been called
957console.log( callbacks.fired() );
958```
959 */
960 fired(): boolean;
961 /**
962 * Call all callbacks in a list with the given context and arguments.
963 * @param context A reference to the context in which the callbacks in the list should be fired.
964 * @param args An argument, or array of arguments, to pass to the callbacks in the list.
965 * @see \`{@link https://api.jquery.com/callbacks.fireWith/ }\`
966 * @since 1.7
967 * @example ​ ````Use callbacks.fireWith() to fire a list of callbacks with a specific context and an array of arguments:
968```javascript
969// A sample logging function to be added to a callbacks list
970var log = function( value1, value2 ) {
971 console.log( "Received: " + value1 + "," + value2 );
972};
973
974var callbacks = $.Callbacks();
975
976// Add the log method to the callbacks list
977callbacks.add( log );
978
979// Fire the callbacks on the list using the context "window"
980// and an arguments array
981
982callbacks.fireWith( window, [ "foo","bar" ] );
983// Outputs: "Received: foo, bar"
984```
985 */
986 fireWith(context: object, args?: ArrayLike<any>): this;
987 /**
988 * Determine whether or not the list has any callbacks attached. If a callback is provided as an argument, determine whether it is in a list.
989 * @param callback The callback to search for.
990 * @see \`{@link https://api.jquery.com/callbacks.has/ }\`
991 * @since 1.7
992 * @example ​ ````Use callbacks.has() to check if a callback list contains a specific callback:
993```javascript
994// A sample logging function to be added to a callbacks list
995var foo = function( value1, value2 ) {
996 console.log( "Received: " + value1 + "," + value2 );
997};
998
999// A second function which will not be added to the list
1000var bar = function( value1, value2 ) {
1001 console.log( "foobar" );
1002};
1003
1004var callbacks = $.Callbacks();
1005
1006// Add the log method to the callbacks list
1007callbacks.add( foo );
1008
1009// Determine which callbacks are in the list
1010console.log( callbacks.has( foo ) );
1011// true
1012console.log( callbacks.has( bar ) );
1013// false
1014```
1015 */
1016 has(callback?: T): boolean;
1017 /**
1018 * Lock a callback list in its current state.
1019 * @see \`{@link https://api.jquery.com/callbacks.lock/ }\`
1020 * @since 1.7
1021 * @example ​ ````Use callbacks.lock() to lock a callback list to avoid further changes being made to the list state:
1022```javascript
1023// A sample logging function to be added to a callbacks list
1024var foo = function( value ) {
1025 console.log( "foo:" + value );
1026};
1027
1028var callbacks = $.Callbacks();
1029
1030// Add the logging function to the callback list
1031callbacks.add( foo );
1032
1033// Fire the items on the list, passing an argument
1034callbacks.fire( "hello" );
1035// Outputs "foo: hello"
1036
1037// Lock the callbacks list
1038callbacks.lock();
1039
1040// Try firing the items again
1041callbacks.fire( "world" );
1042
1043// As the list was locked, no items were called,
1044// so "world" isn't logged
1045```
1046 * @example ​ ````Use callbacks.lock() to lock a callback list with &quot;memory,&quot; and then resume using the list:
1047```html
1048<!doctype html>
1049<html lang="en">
1050<head>
1051 <meta charset="utf-8">
1052 <title>callbacks.lock demo</title>
1053 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1054</head>
1055<body>
1056
1057<div id="log"></div>
1058
1059<script>
1060// Simple function for logging results
1061var log = function( value ) {
1062 $( "#log" ).append( "<p>" + value + "</p>" );
1063};
1064
1065// Two sample functions to be added to a callbacks list
1066var foo = function( value ) {
1067 log( "foo: " + value );
1068};
1069var bar = function( value ) {
1070 log( "bar: " + value );
1071};
1072
1073// Create the callbacks object with the "memory" flag
1074var callbacks = $.Callbacks( "memory" );
1075
1076// Add the foo logging function to the callback list
1077callbacks.add( foo );
1078
1079// Fire the items on the list, passing an argument
1080callbacks.fire( "hello" );
1081// Outputs "foo: hello"
1082
1083// Lock the callbacks list
1084callbacks.lock();
1085
1086// Try firing the items again
1087callbacks.fire( "world" );
1088// As the list was locked, no items were called,
1089// so "foo: world" isn't logged
1090
1091// Add the foo function to the callback list again
1092callbacks.add( foo );
1093
1094// Try firing the items again
1095callbacks.fire( "silentArgument" );
1096// Outputs "foo: hello" because the argument value was stored in memory
1097
1098// Add the bar function to the callback list
1099callbacks.add( bar );
1100
1101callbacks.fire( "youHadMeAtHello" );
1102// Outputs "bar: hello" because the list is still locked,
1103// and the argument value is still stored in memory
1104</script>
1105
1106</body>
1107</html>
1108```
1109 */
1110 lock(): this;
1111 /**
1112 * Determine if the callbacks list has been locked.
1113 * @see \`{@link https://api.jquery.com/callbacks.locked/ }\`
1114 * @since 1.7
1115 * @example ​ ````Use callbacks.locked() to determine the lock-state of a callback list:
1116```javascript
1117// A sample logging function to be added to a callbacks list
1118var foo = function( value ) {
1119 console.log( "foo: " + value );
1120};
1121
1122var callbacks = $.Callbacks();
1123
1124// Add the logging function to the callback list
1125callbacks.add( foo );
1126
1127// Fire the items on the list, passing an argument
1128callbacks.fire( "hello" );
1129// Outputs "foo: hello"
1130
1131// Lock the callbacks list
1132callbacks.lock();
1133
1134// Test the lock-state of the list
1135console.log ( callbacks.locked() );
1136// true
1137```
1138 */
1139 locked(): boolean;
1140 /**
1141 * Remove a callback or a collection of callbacks from a callback list.
1142 * @param callbacks A function, or array of functions, that are to be removed from the callback list.
1143 * @see \`{@link https://api.jquery.com/callbacks.remove/ }\`
1144 * @since 1.7
1145 * @example ​ ````Use callbacks.remove() to remove callbacks from a callback list:
1146```javascript
1147// A sample logging function to be added to a callbacks list
1148var foo = function( value ) {
1149 console.log( "foo: " + value );
1150};
1151
1152var callbacks = $.Callbacks();
1153
1154// Add the function "foo" to the list
1155callbacks.add( foo );
1156
1157// Fire the items on the list
1158callbacks.fire( "hello" );
1159// Outputs: "foo: hello"
1160
1161// Remove "foo" from the callback list
1162callbacks.remove( foo );
1163
1164// Fire the items on the list again
1165callbacks.fire( "world" );
1166
1167// Nothing output as "foo" is no longer in the list
1168```
1169 */
1170 remove(...callbacks: T[]): this;
1171 }
1172
1173 // #endregion
1174
1175 // region CSS hooks
1176 // #region CSS hooks
1177
1178 // Workaround for TypeScript 2.3 which does not have support for weak types handling.
1179 type CSSHook<TElement> =
1180 & Partial<_CSSHook<TElement>>
1181 & (
1182 | Pick<_CSSHook<TElement>, "get">
1183 | Pick<_CSSHook<TElement>, "set">
1184 );
1185
1186 interface _CSSHook<TElement> {
1187 get(elem: TElement, computed: any, extra: any): any;
1188 set(elem: TElement, value: any): void;
1189 }
1190
1191 interface CSSHooks {
1192 // Set to HTMLElement to minimize breaks but should probably be Element.
1193 [propertyName: string]: CSSHook<HTMLElement>;
1194 }
1195
1196 // #endregion
1197
1198 // region Deferred
1199 // #region Deferred
1200
1201 /**
1202 * Any object that has a then method.
1203 */
1204 interface Thenable<T> extends PromiseLike<T> {}
1205
1206 // Type parameter guide
1207 // --------------------
1208 // Each type parameter represents a parameter in one of the three possible callbacks.
1209 //
1210 // The first letter indicates which position the parameter is in.
1211 //
1212 // T = A = 1st position
1213 // U = B = 2nd position
1214 // V = C = 3rd position
1215 // S = R = rest position
1216 //
1217 // The second letter indicates which whether it is a [R]esolve, Re[J]ect, or [N]otify value.
1218 //
1219 // The third letter indicates whether the value is returned in the [D]one filter, [F]ail filter, or [P]rogress filter.
1220
1221 /**
1222 * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred.
1223 * @see \`{@link https://api.jquery.com/Types/#Promise }\`
1224 */
1225 interface PromiseBase<TR, TJ, TN, UR, UJ, UN, VR, VJ, VN, SR, SJ, SN> {
1226 /**
1227 * Add handlers to be called when the Deferred object is either resolved or rejected.
1228 * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected.
1229 * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
1230 * @see \`{@link https://api.jquery.com/deferred.always/ }\`
1231 * @since 1.6
1232 * @example ​ ````Since the jQuery.get() method returns a jqXHR object, which is derived from a Deferred object, we can attach a callback for both success and error using the deferred.always() method.
1233```javascript
1234$.get( "test.php" ).always(function() {
1235 alert( "$.get completed with success or error callback arguments" );
1236});
1237```
1238 */
1239 always(
1240 alwaysCallback: TypeOrArray<Deferred.CallbackBase<TR | TJ, UR | UJ, VR | VJ, SR | SJ>>,
1241 ...alwaysCallbacks: Array<TypeOrArray<Deferred.CallbackBase<TR | TJ, UR | UJ, VR | VJ, SR | SJ>>>
1242 ): this;
1243 /**
1244 * Add handlers to be called when the Deferred object is resolved.
1245 * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved.
1246 * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
1247 * @see \`{@link https://api.jquery.com/deferred.done/ }\`
1248 * @since 1.5
1249 * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach a success callback using the .done() method.
1250```javascript
1251$.get( "test.php" ).done(function() {
1252 alert( "$.get succeeded" );
1253});
1254```
1255 * @example ​ ````Resolve a Deferred object when the user clicks a button, triggering a number of callback functions:
1256```html
1257<!doctype html>
1258<html lang="en">
1259<head>
1260 <meta charset="utf-8">
1261 <title>deferred.done demo</title>
1262 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
1263</head>
1264<body>
1265
1266<button>Go</button>
1267<p>Ready...</p>
1268
1269<script>
1270// 3 functions to call when the Deferred object is resolved
1271function fn1() {
1272 $( "p" ).append( " 1 " );
1273}
1274function fn2() {
1275 $( "p" ).append( " 2 " );
1276}
1277function fn3( n ) {
1278 $( "p" ).append( n + " 3 " + n );
1279}
1280
1281// Create a deferred object
1282var dfd = $.Deferred();
1283
1284// Add handlers to be called when dfd is resolved
1285dfd
1286// .done() can take any number of functions or arrays of functions
1287 .done( [ fn1, fn2 ], fn3, [ fn2, fn1 ] )
1288// We can chain done methods, too
1289 .done(function( n ) {
1290 $( "p" ).append( n + " we're done." );
1291 });
1292
1293// Resolve the Deferred object when the button is clicked
1294$( "button" ).on( "click", function() {
1295 dfd.resolve( "and" );
1296});
1297</script>
1298
1299</body>
1300</html>
1301```
1302 */
1303 done(
1304 doneCallback: TypeOrArray<Deferred.CallbackBase<TR, UR, VR, SR>>,
1305 ...doneCallbacks: Array<TypeOrArray<Deferred.CallbackBase<TR, UR, VR, SR>>>
1306 ): this;
1307 /**
1308 * Add handlers to be called when the Deferred object is rejected.
1309 * @param failCallback A function, or array of functions, that are called when the Deferred is rejected.
1310 * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
1311 * @see \`{@link https://api.jquery.com/deferred.fail/ }\`
1312 * @since 1.5
1313 * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred, you can attach a success and failure callback using the deferred.done() and deferred.fail() methods.
1314```javascript
1315$.get( "test.php" )
1316 .done(function() {
1317 alert( "$.get succeeded" );
1318 })
1319 .fail(function() {
1320 alert( "$.get failed!" );
1321 });
1322```
1323 */
1324 fail(
1325 failCallback: TypeOrArray<Deferred.CallbackBase<TJ, UJ, VJ, SJ>>,
1326 ...failCallbacks: Array<TypeOrArray<Deferred.CallbackBase<TJ, UJ, VJ, SJ>>>
1327 ): this;
1328 /**
1329 * Add handlers to be called when the Deferred object generates progress notifications.
1330 * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications.
1331 * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates
1332 * progress notifications.
1333 * @see \`{@link https://api.jquery.com/deferred.progress/ }\`
1334 * @since 1.7
1335 */
1336 progress(
1337 progressCallback: TypeOrArray<Deferred.CallbackBase<TN, UN, VN, SN>>,
1338 ...progressCallbacks: Array<TypeOrArray<Deferred.CallbackBase<TN, UN, VN, SN>>>
1339 ): this;
1340 /**
1341 * Return a Deferred's Promise object.
1342 * @param target Object onto which the promise methods have to be attached
1343 * @see \`{@link https://api.jquery.com/deferred.promise/ }\`
1344 * @since 1.5
1345 * @example ​ ````Create a Deferred and set two timer-based functions to either resolve or reject the Deferred after a random interval. Whichever one fires first &quot;wins&quot; and will call one of the callbacks. The second timeout has no effect since the Deferred is already complete (in a resolved or rejected state) from the first timeout action. Also set a timer-based progress notification function, and call a progress handler that adds &quot;working...&quot; to the document body.
1346```javascript
1347function asyncEvent() {
1348 var dfd = jQuery.Deferred();
1349
1350 // Resolve after a random interval
1351 setTimeout(function() {
1352 dfd.resolve( "hurray" );
1353 }, Math.floor( 400 + Math.random() * 2000 ) );
1354
1355 // Reject after a random interval
1356 setTimeout(function() {
1357 dfd.reject( "sorry" );
1358 }, Math.floor( 400 + Math.random() * 2000 ) );
1359
1360 // Show a "working..." message every half-second
1361 setTimeout(function working() {
1362 if ( dfd.state() === "pending" ) {
1363 dfd.notify( "working... " );
1364 setTimeout( working, 500 );
1365 }
1366 }, 1 );
1367
1368 // Return the Promise so caller can't change the Deferred
1369 return dfd.promise();
1370}
1371
1372// Attach a done, fail, and progress handler for the asyncEvent
1373$.when( asyncEvent() ).then(
1374 function( status ) {
1375 alert( status + ", things are going well" );
1376 },
1377 function( status ) {
1378 alert( status + ", you fail this time" );
1379 },
1380 function( status ) {
1381 $( "body" ).append( status );
1382 }
1383);
1384```
1385 */
1386 promise<TTarget extends object>(target: TTarget): this & TTarget;
1387 /**
1388 * Return a Deferred's Promise object.
1389 * @see \`{@link https://api.jquery.com/deferred.promise/ }\`
1390 * @since 1.5
1391 * @example ​ ````Use the target argument to promote an existing object to a Promise:
1392```javascript
1393// Existing object
1394var obj = {
1395 hello: function( name ) {
1396 alert( "Hello " + name );
1397 }
1398 },
1399 // Create a Deferred
1400 defer = $.Deferred();
1401
1402// Set object as a promise
1403defer.promise( obj );
1404
1405// Resolve the deferred
1406defer.resolve( "John" );
1407
1408// Use the object as a Promise
1409obj.done(function( name ) {
1410 obj.hello( name ); // Will alert "Hello John"
1411}).hello( "Karl" ); // Will alert "Hello Karl"
1412```
1413 */
1414 promise(): this;
1415 /**
1416 * Determine the current state of a Deferred object.
1417 * @see \`{@link https://api.jquery.com/deferred.state/ }\`
1418 * @since 1.7
1419 */
1420 state(): "pending" | "resolved" | "rejected";
1421
1422 // region pipe
1423 // #region pipe
1424
1425 /**
1426 * Utility method to filter and/or chain Deferreds.
1427 * @param doneFilter An optional function that is called when the Deferred is resolved.
1428 * @param failFilter An optional function that is called when the Deferred is rejected.
1429 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
1430 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
1431 * @since 1.6
1432 * @since 1.7
1433 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
1434 *
1435 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
1436 *
1437 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
1438 * @example ​ ````Filter resolve value:
1439```javascript
1440var defer = $.Deferred(),
1441 filtered = defer.pipe(function( value ) {
1442 return value * 2;
1443 });
1444
1445defer.resolve( 5 );
1446filtered.done(function( value ) {
1447 alert( "Value is ( 2*5 = ) 10: " + value );
1448});
1449```
1450 * @example ​ ````Filter reject value:
1451```javascript
1452var defer = $.Deferred(),
1453 filtered = defer.pipe( null, function( value ) {
1454 return value * 3;
1455 });
1456
1457defer.reject( 6 );
1458filtered.fail(function( value ) {
1459 alert( "Value is ( 3*6 = ) 18: " + value );
1460});
1461```
1462 * @example ​ ````Chain tasks:
1463```javascript
1464var request = $.ajax( url, { dataType: "json" } ),
1465 chained = request.pipe(function( data ) {
1466 return $.ajax( url2, { data: { user: data.userId } } );
1467 });
1468
1469chained.done(function( data ) {
1470 // data retrieved from url2 as provided by the first request
1471});
1472```
1473 */
1474 pipe<
1475 ARD = never,
1476 AJD = never,
1477 AND = never,
1478 BRD = never,
1479 BJD = never,
1480 BND = never,
1481 CRD = never,
1482 CJD = never,
1483 CND = never,
1484 RRD = never,
1485 RJD = never,
1486 RND = never,
1487 ARF = never,
1488 AJF = never,
1489 ANF = never,
1490 BRF = never,
1491 BJF = never,
1492 BNF = never,
1493 CRF = never,
1494 CJF = never,
1495 CNF = never,
1496 RRF = never,
1497 RJF = never,
1498 RNF = never,
1499 ARP = never,
1500 AJP = never,
1501 ANP = never,
1502 BRP = never,
1503 BJP = never,
1504 BNP = never,
1505 CRP = never,
1506 CJP = never,
1507 CNP = never,
1508 RRP = never,
1509 RJP = never,
1510 RNP = never,
1511 >(
1512 doneFilter: (
1513 t: TR,
1514 u: UR,
1515 v: VR,
1516 ...s: SR[]
1517 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
1518 failFilter: (
1519 t: TJ,
1520 u: UJ,
1521 v: VJ,
1522 ...s: SJ[]
1523 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
1524 progressFilter: (
1525 t: TN,
1526 u: UN,
1527 v: VN,
1528 ...s: SN[]
1529 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
1530 ): PromiseBase<
1531 ARD | ARF | ARP,
1532 AJD | AJF | AJP,
1533 AND | ANF | ANP,
1534 BRD | BRF | BRP,
1535 BJD | BJF | BJP,
1536 BND | BNF | BNP,
1537 CRD | CRF | CRP,
1538 CJD | CJF | CJP,
1539 CND | CNF | CNP,
1540 RRD | RRF | RRP,
1541 RJD | RJF | RJP,
1542 RND | RNF | RNP
1543 >;
1544 /**
1545 * Utility method to filter and/or chain Deferreds.
1546 * @param doneFilter An optional function that is called when the Deferred is resolved.
1547 * @param failFilter An optional function that is called when the Deferred is rejected.
1548 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
1549 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
1550 * @since 1.6
1551 * @since 1.7
1552 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
1553 *
1554 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
1555 *
1556 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
1557 * @example ​ ````Filter reject value:
1558```javascript
1559var defer = $.Deferred(),
1560 filtered = defer.pipe( null, function( value ) {
1561 return value * 3;
1562 });
1563
1564defer.reject( 6 );
1565filtered.fail(function( value ) {
1566 alert( "Value is ( 3*6 = ) 18: " + value );
1567});
1568```
1569 * @example ​ ````Chain tasks:
1570```javascript
1571var request = $.ajax( url, { dataType: "json" } ),
1572 chained = request.pipe(function( data ) {
1573 return $.ajax( url2, { data: { user: data.userId } } );
1574 });
1575
1576chained.done(function( data ) {
1577 // data retrieved from url2 as provided by the first request
1578});
1579```
1580 */
1581 pipe<
1582 ARF = never,
1583 AJF = never,
1584 ANF = never,
1585 BRF = never,
1586 BJF = never,
1587 BNF = never,
1588 CRF = never,
1589 CJF = never,
1590 CNF = never,
1591 RRF = never,
1592 RJF = never,
1593 RNF = never,
1594 ARP = never,
1595 AJP = never,
1596 ANP = never,
1597 BRP = never,
1598 BJP = never,
1599 BNP = never,
1600 CRP = never,
1601 CJP = never,
1602 CNP = never,
1603 RRP = never,
1604 RJP = never,
1605 RNP = never,
1606 >(
1607 doneFilter: null,
1608 failFilter: (
1609 t: TJ,
1610 u: UJ,
1611 v: VJ,
1612 ...s: SJ[]
1613 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
1614 progressFilter: (
1615 t: TN,
1616 u: UN,
1617 v: VN,
1618 ...s: SN[]
1619 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
1620 ): PromiseBase<
1621 ARF | ARP,
1622 AJF | AJP,
1623 ANF | ANP,
1624 BRF | BRP,
1625 BJF | BJP,
1626 BNF | BNP,
1627 CRF | CRP,
1628 CJF | CJP,
1629 CNF | CNP,
1630 RRF | RRP,
1631 RJF | RJP,
1632 RNF | RNP
1633 >;
1634 /**
1635 * Utility method to filter and/or chain Deferreds.
1636 * @param doneFilter An optional function that is called when the Deferred is resolved.
1637 * @param failFilter An optional function that is called when the Deferred is rejected.
1638 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
1639 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
1640 * @since 1.6
1641 * @since 1.7
1642 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
1643 *
1644 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
1645 *
1646 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
1647 * @example ​ ````Filter resolve value:
1648```javascript
1649var defer = $.Deferred(),
1650 filtered = defer.pipe(function( value ) {
1651 return value * 2;
1652 });
1653
1654defer.resolve( 5 );
1655filtered.done(function( value ) {
1656 alert( "Value is ( 2*5 = ) 10: " + value );
1657});
1658```
1659 * @example ​ ````Chain tasks:
1660```javascript
1661var request = $.ajax( url, { dataType: "json" } ),
1662 chained = request.pipe(function( data ) {
1663 return $.ajax( url2, { data: { user: data.userId } } );
1664 });
1665
1666chained.done(function( data ) {
1667 // data retrieved from url2 as provided by the first request
1668});
1669```
1670 */
1671 pipe<
1672 ARD = never,
1673 AJD = never,
1674 AND = never,
1675 BRD = never,
1676 BJD = never,
1677 BND = never,
1678 CRD = never,
1679 CJD = never,
1680 CND = never,
1681 RRD = never,
1682 RJD = never,
1683 RND = never,
1684 ARP = never,
1685 AJP = never,
1686 ANP = never,
1687 BRP = never,
1688 BJP = never,
1689 BNP = never,
1690 CRP = never,
1691 CJP = never,
1692 CNP = never,
1693 RRP = never,
1694 RJP = never,
1695 RNP = never,
1696 >(
1697 doneFilter: (
1698 t: TR,
1699 u: UR,
1700 v: VR,
1701 ...s: SR[]
1702 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
1703 failFilter: null,
1704 progressFilter: (
1705 t: TN,
1706 u: UN,
1707 v: VN,
1708 ...s: SN[]
1709 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
1710 ): PromiseBase<
1711 ARD | ARP,
1712 AJD | AJP,
1713 AND | ANP,
1714 BRD | BRP,
1715 BJD | BJP,
1716 BND | BNP,
1717 CRD | CRP,
1718 CJD | CJP,
1719 CND | CNP,
1720 RRD | RRP,
1721 RJD | RJP,
1722 RND | RNP
1723 >;
1724 /**
1725 * Utility method to filter and/or chain Deferreds.
1726 * @param doneFilter An optional function that is called when the Deferred is resolved.
1727 * @param failFilter An optional function that is called when the Deferred is rejected.
1728 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
1729 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
1730 * @since 1.6
1731 * @since 1.7
1732 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
1733 *
1734 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
1735 *
1736 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
1737 * @example ​ ````Chain tasks:
1738```javascript
1739var request = $.ajax( url, { dataType: "json" } ),
1740 chained = request.pipe(function( data ) {
1741 return $.ajax( url2, { data: { user: data.userId } } );
1742 });
1743
1744chained.done(function( data ) {
1745 // data retrieved from url2 as provided by the first request
1746});
1747```
1748 */
1749 pipe<
1750 ARP = never,
1751 AJP = never,
1752 ANP = never,
1753 BRP = never,
1754 BJP = never,
1755 BNP = never,
1756 CRP = never,
1757 CJP = never,
1758 CNP = never,
1759 RRP = never,
1760 RJP = never,
1761 RNP = never,
1762 >(
1763 doneFilter: null,
1764 failFilter: null,
1765 progressFilter?: (
1766 t: TN,
1767 u: UN,
1768 v: VN,
1769 ...s: SN[]
1770 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
1771 ): PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP>;
1772 /**
1773 * Utility method to filter and/or chain Deferreds.
1774 * @param doneFilter An optional function that is called when the Deferred is resolved.
1775 * @param failFilter An optional function that is called when the Deferred is rejected.
1776 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
1777 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
1778 * @since 1.6
1779 * @since 1.7
1780 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
1781 *
1782 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
1783 *
1784 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
1785 * @example ​ ````Filter resolve value:
1786```javascript
1787var defer = $.Deferred(),
1788 filtered = defer.pipe(function( value ) {
1789 return value * 2;
1790 });
1791
1792defer.resolve( 5 );
1793filtered.done(function( value ) {
1794 alert( "Value is ( 2*5 = ) 10: " + value );
1795});
1796```
1797 * @example ​ ````Filter reject value:
1798```javascript
1799var defer = $.Deferred(),
1800 filtered = defer.pipe( null, function( value ) {
1801 return value * 3;
1802 });
1803
1804defer.reject( 6 );
1805filtered.fail(function( value ) {
1806 alert( "Value is ( 3*6 = ) 18: " + value );
1807});
1808```
1809 * @example ​ ````Chain tasks:
1810```javascript
1811var request = $.ajax( url, { dataType: "json" } ),
1812 chained = request.pipe(function( data ) {
1813 return $.ajax( url2, { data: { user: data.userId } } );
1814 });
1815
1816chained.done(function( data ) {
1817 // data retrieved from url2 as provided by the first request
1818});
1819```
1820 */
1821 pipe<
1822 ARD = never,
1823 AJD = never,
1824 AND = never,
1825 BRD = never,
1826 BJD = never,
1827 BND = never,
1828 CRD = never,
1829 CJD = never,
1830 CND = never,
1831 RRD = never,
1832 RJD = never,
1833 RND = never,
1834 ARF = never,
1835 AJF = never,
1836 ANF = never,
1837 BRF = never,
1838 BJF = never,
1839 BNF = never,
1840 CRF = never,
1841 CJF = never,
1842 CNF = never,
1843 RRF = never,
1844 RJF = never,
1845 RNF = never,
1846 >(
1847 doneFilter: (
1848 t: TR,
1849 u: UR,
1850 v: VR,
1851 ...s: SR[]
1852 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
1853 failFilter: (
1854 t: TJ,
1855 u: UJ,
1856 v: VJ,
1857 ...s: SJ[]
1858 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
1859 progressFilter?: null,
1860 ): PromiseBase<
1861 ARD | ARF,
1862 AJD | AJF,
1863 AND | ANF,
1864 BRD | BRF,
1865 BJD | BJF,
1866 BND | BNF,
1867 CRD | CRF,
1868 CJD | CJF,
1869 CND | CNF,
1870 RRD | RRF,
1871 RJD | RJF,
1872 RND | RNF
1873 >;
1874 /**
1875 * Utility method to filter and/or chain Deferreds.
1876 * @param doneFilter An optional function that is called when the Deferred is resolved.
1877 * @param failFilter An optional function that is called when the Deferred is rejected.
1878 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
1879 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
1880 * @since 1.6
1881 * @since 1.7
1882 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
1883 *
1884 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
1885 *
1886 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
1887 * @example ​ ````Filter reject value:
1888```javascript
1889var defer = $.Deferred(),
1890 filtered = defer.pipe( null, function( value ) {
1891 return value * 3;
1892 });
1893
1894defer.reject( 6 );
1895filtered.fail(function( value ) {
1896 alert( "Value is ( 3*6 = ) 18: " + value );
1897});
1898```
1899 * @example ​ ````Chain tasks:
1900```javascript
1901var request = $.ajax( url, { dataType: "json" } ),
1902 chained = request.pipe(function( data ) {
1903 return $.ajax( url2, { data: { user: data.userId } } );
1904 });
1905
1906chained.done(function( data ) {
1907 // data retrieved from url2 as provided by the first request
1908});
1909```
1910 */
1911 pipe<
1912 ARF = never,
1913 AJF = never,
1914 ANF = never,
1915 BRF = never,
1916 BJF = never,
1917 BNF = never,
1918 CRF = never,
1919 CJF = never,
1920 CNF = never,
1921 RRF = never,
1922 RJF = never,
1923 RNF = never,
1924 >(
1925 doneFilter: null,
1926 failFilter: (
1927 t: TJ,
1928 u: UJ,
1929 v: VJ,
1930 ...s: SJ[]
1931 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
1932 progressFilter?: null,
1933 ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
1934 /**
1935 * Utility method to filter and/or chain Deferreds.
1936 * @param doneFilter An optional function that is called when the Deferred is resolved.
1937 * @param failFilter An optional function that is called when the Deferred is rejected.
1938 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
1939 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
1940 * @since 1.6
1941 * @since 1.7
1942 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
1943 *
1944 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
1945 *
1946 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
1947 * @example ​ ````Filter resolve value:
1948```javascript
1949var defer = $.Deferred(),
1950 filtered = defer.pipe(function( value ) {
1951 return value * 2;
1952 });
1953
1954defer.resolve( 5 );
1955filtered.done(function( value ) {
1956 alert( "Value is ( 2*5 = ) 10: " + value );
1957});
1958```
1959 * @example ​ ````Chain tasks:
1960```javascript
1961var request = $.ajax( url, { dataType: "json" } ),
1962 chained = request.pipe(function( data ) {
1963 return $.ajax( url2, { data: { user: data.userId } } );
1964 });
1965
1966chained.done(function( data ) {
1967 // data retrieved from url2 as provided by the first request
1968});
1969```
1970 */
1971 pipe<
1972 ARD = never,
1973 AJD = never,
1974 AND = never,
1975 BRD = never,
1976 BJD = never,
1977 BND = never,
1978 CRD = never,
1979 CJD = never,
1980 CND = never,
1981 RRD = never,
1982 RJD = never,
1983 RND = never,
1984 >(
1985 doneFilter: (
1986 t: TR,
1987 u: UR,
1988 v: VR,
1989 ...s: SR[]
1990 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
1991 failFilter?: null,
1992 progressFilter?: null,
1993 ): PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND>;
1994
1995 // #endregion
1996
1997 // region then
1998 // #region then
1999
2000 /**
2001 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
2002 * @param doneFilter An optional function that is called when the Deferred is resolved.
2003 * @param failFilter An optional function that is called when the Deferred is rejected.
2004 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
2005 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
2006 * @since 1.8
2007 * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method.
2008```javascript
2009$.get( "test.php" ).then(
2010 function() {
2011 alert( "$.get succeeded" );
2012 }, function() {
2013 alert( "$.get failed!" );
2014 }
2015);
2016```
2017 * @example ​ ````Filter the resolve value:
2018```html
2019<!doctype html>
2020<html lang="en">
2021<head>
2022 <meta charset="utf-8">
2023 <title>deferred.then demo</title>
2024 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2025</head>
2026<body>
2027
2028<button>Filter Resolve</button>
2029<p></p>
2030
2031<script>
2032var filterResolve = function() {
2033 var defer = $.Deferred(),
2034 filtered = defer.then(function( value ) {
2035 return value * 2;
2036 });
2037
2038 defer.resolve( 5 );
2039 filtered.done(function( value ) {
2040 $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
2041 });
2042};
2043
2044$( "button" ).on( "click", filterResolve );
2045</script>
2046
2047</body>
2048</html>
2049```
2050 * @example ​ ````Filter reject value:
2051```javascript
2052var defer = $.Deferred(),
2053 filtered = defer.then( null, function( value ) {
2054 return value * 3;
2055 });
2056
2057defer.reject( 6 );
2058filtered.fail(function( value ) {
2059 alert( "Value is ( 3*6 = ) 18: " + value );
2060});
2061```
2062 * @example ​ ````Chain tasks:
2063```javascript
2064var request = $.ajax( url, { dataType: "json" } ),
2065 chained = request.then(function( data ) {
2066 return $.ajax( url2, { data: { user: data.userId } } );
2067 });
2068
2069chained.done(function( data ) {
2070 // data retrieved from url2 as provided by the first request
2071});
2072```
2073 */
2074 then<
2075 ARD = never,
2076 AJD = never,
2077 AND = never,
2078 BRD = never,
2079 BJD = never,
2080 BND = never,
2081 CRD = never,
2082 CJD = never,
2083 CND = never,
2084 RRD = never,
2085 RJD = never,
2086 RND = never,
2087 ARF = never,
2088 AJF = never,
2089 ANF = never,
2090 BRF = never,
2091 BJF = never,
2092 BNF = never,
2093 CRF = never,
2094 CJF = never,
2095 CNF = never,
2096 RRF = never,
2097 RJF = never,
2098 RNF = never,
2099 ARP = never,
2100 AJP = never,
2101 ANP = never,
2102 BRP = never,
2103 BJP = never,
2104 BNP = never,
2105 CRP = never,
2106 CJP = never,
2107 CNP = never,
2108 RRP = never,
2109 RJP = never,
2110 RNP = never,
2111 >(
2112 doneFilter: (
2113 t: TR,
2114 u: UR,
2115 v: VR,
2116 ...s: SR[]
2117 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
2118 failFilter: (
2119 t: TJ,
2120 u: UJ,
2121 v: VJ,
2122 ...s: SJ[]
2123 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
2124 progressFilter: (
2125 t: TN,
2126 u: UN,
2127 v: VN,
2128 ...s: SN[]
2129 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
2130 ): PromiseBase<
2131 ARD | ARF | ARP,
2132 AJD | AJF | AJP,
2133 AND | ANF | ANP,
2134 BRD | BRF | BRP,
2135 BJD | BJF | BJP,
2136 BND | BNF | BNP,
2137 CRD | CRF | CRP,
2138 CJD | CJF | CJP,
2139 CND | CNF | CNP,
2140 RRD | RRF | RRP,
2141 RJD | RJF | RJP,
2142 RND | RNF | RNP
2143 >;
2144 /**
2145 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
2146 * @param doneFilter An optional function that is called when the Deferred is resolved.
2147 * @param failFilter An optional function that is called when the Deferred is rejected.
2148 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
2149 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
2150 * @since 1.8
2151 * @example ​ ````Filter reject value:
2152```javascript
2153var defer = $.Deferred(),
2154 filtered = defer.then( null, function( value ) {
2155 return value * 3;
2156 });
2157
2158defer.reject( 6 );
2159filtered.fail(function( value ) {
2160 alert( "Value is ( 3*6 = ) 18: " + value );
2161});
2162```
2163 * @example ​ ````Chain tasks:
2164```javascript
2165var request = $.ajax( url, { dataType: "json" } ),
2166 chained = request.then(function( data ) {
2167 return $.ajax( url2, { data: { user: data.userId } } );
2168 });
2169
2170chained.done(function( data ) {
2171 // data retrieved from url2 as provided by the first request
2172});
2173```
2174 */
2175 then<
2176 ARF = never,
2177 AJF = never,
2178 ANF = never,
2179 BRF = never,
2180 BJF = never,
2181 BNF = never,
2182 CRF = never,
2183 CJF = never,
2184 CNF = never,
2185 RRF = never,
2186 RJF = never,
2187 RNF = never,
2188 ARP = never,
2189 AJP = never,
2190 ANP = never,
2191 BRP = never,
2192 BJP = never,
2193 BNP = never,
2194 CRP = never,
2195 CJP = never,
2196 CNP = never,
2197 RRP = never,
2198 RJP = never,
2199 RNP = never,
2200 >(
2201 doneFilter: null,
2202 failFilter: (
2203 t: TJ,
2204 u: UJ,
2205 v: VJ,
2206 ...s: SJ[]
2207 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
2208 progressFilter: (
2209 t: TN,
2210 u: UN,
2211 v: VN,
2212 ...s: SN[]
2213 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
2214 ): PromiseBase<
2215 ARF | ARP,
2216 AJF | AJP,
2217 ANF | ANP,
2218 BRF | BRP,
2219 BJF | BJP,
2220 BNF | BNP,
2221 CRF | CRP,
2222 CJF | CJP,
2223 CNF | CNP,
2224 RRF | RRP,
2225 RJF | RJP,
2226 RNF | RNP
2227 >;
2228 /**
2229 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
2230 * @param doneFilter An optional function that is called when the Deferred is resolved.
2231 * @param failFilter An optional function that is called when the Deferred is rejected.
2232 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
2233 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
2234 * @since 1.8
2235 * @example ​ ````Filter the resolve value:
2236```html
2237<!doctype html>
2238<html lang="en">
2239<head>
2240 <meta charset="utf-8">
2241 <title>deferred.then demo</title>
2242 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2243</head>
2244<body>
2245
2246<button>Filter Resolve</button>
2247<p></p>
2248
2249<script>
2250var filterResolve = function() {
2251 var defer = $.Deferred(),
2252 filtered = defer.then(function( value ) {
2253 return value * 2;
2254 });
2255
2256 defer.resolve( 5 );
2257 filtered.done(function( value ) {
2258 $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
2259 });
2260};
2261
2262$( "button" ).on( "click", filterResolve );
2263</script>
2264
2265</body>
2266</html>
2267```
2268 * @example ​ ````Chain tasks:
2269```javascript
2270var request = $.ajax( url, { dataType: "json" } ),
2271 chained = request.then(function( data ) {
2272 return $.ajax( url2, { data: { user: data.userId } } );
2273 });
2274
2275chained.done(function( data ) {
2276 // data retrieved from url2 as provided by the first request
2277});
2278```
2279 */
2280 then<
2281 ARD = never,
2282 AJD = never,
2283 AND = never,
2284 BRD = never,
2285 BJD = never,
2286 BND = never,
2287 CRD = never,
2288 CJD = never,
2289 CND = never,
2290 RRD = never,
2291 RJD = never,
2292 RND = never,
2293 ARP = never,
2294 AJP = never,
2295 ANP = never,
2296 BRP = never,
2297 BJP = never,
2298 BNP = never,
2299 CRP = never,
2300 CJP = never,
2301 CNP = never,
2302 RRP = never,
2303 RJP = never,
2304 RNP = never,
2305 >(
2306 doneFilter: (
2307 t: TR,
2308 u: UR,
2309 v: VR,
2310 ...s: SR[]
2311 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
2312 failFilter: null,
2313 progressFilter: (
2314 t: TN,
2315 u: UN,
2316 v: VN,
2317 ...s: SN[]
2318 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
2319 ): PromiseBase<
2320 ARD | ARP,
2321 AJD | AJP,
2322 AND | ANP,
2323 BRD | BRP,
2324 BJD | BJP,
2325 BND | BNP,
2326 CRD | CRP,
2327 CJD | CJP,
2328 CND | CNP,
2329 RRD | RRP,
2330 RJD | RJP,
2331 RND | RNP
2332 >;
2333 /**
2334 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
2335 * @param doneFilter An optional function that is called when the Deferred is resolved.
2336 * @param failFilter An optional function that is called when the Deferred is rejected.
2337 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
2338 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
2339 * @since 1.8
2340 * @example ​ ````Chain tasks:
2341```javascript
2342var request = $.ajax( url, { dataType: "json" } ),
2343 chained = request.then(function( data ) {
2344 return $.ajax( url2, { data: { user: data.userId } } );
2345 });
2346
2347chained.done(function( data ) {
2348 // data retrieved from url2 as provided by the first request
2349});
2350```
2351 */
2352 then<
2353 ARP = never,
2354 AJP = never,
2355 ANP = never,
2356 BRP = never,
2357 BJP = never,
2358 BNP = never,
2359 CRP = never,
2360 CJP = never,
2361 CNP = never,
2362 RRP = never,
2363 RJP = never,
2364 RNP = never,
2365 >(
2366 doneFilter: null,
2367 failFilter: null,
2368 progressFilter?: (
2369 t: TN,
2370 u: UN,
2371 v: VN,
2372 ...s: SN[]
2373 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
2374 ): PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP>;
2375 /**
2376 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
2377 * @param doneFilter An optional function that is called when the Deferred is resolved.
2378 * @param failFilter An optional function that is called when the Deferred is rejected.
2379 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
2380 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
2381 * @since 1.8
2382 * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method.
2383```javascript
2384$.get( "test.php" ).then(
2385 function() {
2386 alert( "$.get succeeded" );
2387 }, function() {
2388 alert( "$.get failed!" );
2389 }
2390);
2391```
2392 * @example ​ ````Filter the resolve value:
2393```html
2394<!doctype html>
2395<html lang="en">
2396<head>
2397 <meta charset="utf-8">
2398 <title>deferred.then demo</title>
2399 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2400</head>
2401<body>
2402
2403<button>Filter Resolve</button>
2404<p></p>
2405
2406<script>
2407var filterResolve = function() {
2408 var defer = $.Deferred(),
2409 filtered = defer.then(function( value ) {
2410 return value * 2;
2411 });
2412
2413 defer.resolve( 5 );
2414 filtered.done(function( value ) {
2415 $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
2416 });
2417};
2418
2419$( "button" ).on( "click", filterResolve );
2420</script>
2421
2422</body>
2423</html>
2424```
2425 * @example ​ ````Filter reject value:
2426```javascript
2427var defer = $.Deferred(),
2428 filtered = defer.then( null, function( value ) {
2429 return value * 3;
2430 });
2431
2432defer.reject( 6 );
2433filtered.fail(function( value ) {
2434 alert( "Value is ( 3*6 = ) 18: " + value );
2435});
2436```
2437 * @example ​ ````Chain tasks:
2438```javascript
2439var request = $.ajax( url, { dataType: "json" } ),
2440 chained = request.then(function( data ) {
2441 return $.ajax( url2, { data: { user: data.userId } } );
2442 });
2443
2444chained.done(function( data ) {
2445 // data retrieved from url2 as provided by the first request
2446});
2447```
2448 */
2449 then<
2450 ARD = never,
2451 AJD = never,
2452 AND = never,
2453 BRD = never,
2454 BJD = never,
2455 BND = never,
2456 CRD = never,
2457 CJD = never,
2458 CND = never,
2459 RRD = never,
2460 RJD = never,
2461 RND = never,
2462 ARF = never,
2463 AJF = never,
2464 ANF = never,
2465 BRF = never,
2466 BJF = never,
2467 BNF = never,
2468 CRF = never,
2469 CJF = never,
2470 CNF = never,
2471 RRF = never,
2472 RJF = never,
2473 RNF = never,
2474 >(
2475 doneFilter: (
2476 t: TR,
2477 u: UR,
2478 v: VR,
2479 ...s: SR[]
2480 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
2481 failFilter: (
2482 t: TJ,
2483 u: UJ,
2484 v: VJ,
2485 ...s: SJ[]
2486 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
2487 progressFilter?: null,
2488 ): PromiseBase<
2489 ARD | ARF,
2490 AJD | AJF,
2491 AND | ANF,
2492 BRD | BRF,
2493 BJD | BJF,
2494 BND | BNF,
2495 CRD | CRF,
2496 CJD | CJF,
2497 CND | CNF,
2498 RRD | RRF,
2499 RJD | RJF,
2500 RND | RNF
2501 >;
2502 /**
2503 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
2504 * @param doneFilter An optional function that is called when the Deferred is resolved.
2505 * @param failFilter An optional function that is called when the Deferred is rejected.
2506 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
2507 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
2508 * @since 1.8
2509 * @example ​ ````Filter reject value:
2510```javascript
2511var defer = $.Deferred(),
2512 filtered = defer.then( null, function( value ) {
2513 return value * 3;
2514 });
2515
2516defer.reject( 6 );
2517filtered.fail(function( value ) {
2518 alert( "Value is ( 3*6 = ) 18: " + value );
2519});
2520```
2521 * @example ​ ````Chain tasks:
2522```javascript
2523var request = $.ajax( url, { dataType: "json" } ),
2524 chained = request.then(function( data ) {
2525 return $.ajax( url2, { data: { user: data.userId } } );
2526 });
2527
2528chained.done(function( data ) {
2529 // data retrieved from url2 as provided by the first request
2530});
2531```
2532 */
2533 then<
2534 ARF = never,
2535 AJF = never,
2536 ANF = never,
2537 BRF = never,
2538 BJF = never,
2539 BNF = never,
2540 CRF = never,
2541 CJF = never,
2542 CNF = never,
2543 RRF = never,
2544 RJF = never,
2545 RNF = never,
2546 >(
2547 doneFilter: null,
2548 failFilter: (
2549 t: TJ,
2550 u: UJ,
2551 v: VJ,
2552 ...s: SJ[]
2553 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
2554 progressFilter?: null,
2555 ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
2556 /**
2557 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
2558 * @param doneFilter An optional function that is called when the Deferred is resolved.
2559 * @param failFilter An optional function that is called when the Deferred is rejected.
2560 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
2561 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
2562 * @since 1.8
2563 * @example ​ ````Filter the resolve value:
2564```html
2565<!doctype html>
2566<html lang="en">
2567<head>
2568 <meta charset="utf-8">
2569 <title>deferred.then demo</title>
2570 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2571</head>
2572<body>
2573
2574<button>Filter Resolve</button>
2575<p></p>
2576
2577<script>
2578var filterResolve = function() {
2579 var defer = $.Deferred(),
2580 filtered = defer.then(function( value ) {
2581 return value * 2;
2582 });
2583
2584 defer.resolve( 5 );
2585 filtered.done(function( value ) {
2586 $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
2587 });
2588};
2589
2590$( "button" ).on( "click", filterResolve );
2591</script>
2592
2593</body>
2594</html>
2595```
2596 * @example ​ ````Chain tasks:
2597```javascript
2598var request = $.ajax( url, { dataType: "json" } ),
2599 chained = request.then(function( data ) {
2600 return $.ajax( url2, { data: { user: data.userId } } );
2601 });
2602
2603chained.done(function( data ) {
2604 // data retrieved from url2 as provided by the first request
2605});
2606```
2607 */
2608 then<
2609 ARD = never,
2610 AJD = never,
2611 AND = never,
2612 BRD = never,
2613 BJD = never,
2614 BND = never,
2615 CRD = never,
2616 CJD = never,
2617 CND = never,
2618 RRD = never,
2619 RJD = never,
2620 RND = never,
2621 >(
2622 doneFilter: (
2623 t: TR,
2624 u: UR,
2625 v: VR,
2626 ...s: SR[]
2627 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
2628 failFilter?: null,
2629 progressFilter?: null,
2630 ): PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND>;
2631
2632 // #endregion
2633
2634 /**
2635 * Add handlers to be called when the Deferred object is rejected.
2636 * @param failFilter A function that is called when the Deferred is rejected.
2637 * @see \`{@link https://api.jquery.com/deferred.catch/ }\`
2638 * @since 3.0
2639 * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can rejection handlers using the .catch method.
2640```javascript
2641$.get( "test.php" )
2642 .then( function() {
2643 alert( "$.get succeeded" );
2644 } )
2645 .catch( function() {
2646 alert( "$.get failed!" );
2647 } );
2648```
2649 */
2650 catch<
2651 ARF = never,
2652 AJF = never,
2653 ANF = never,
2654 BRF = never,
2655 BJF = never,
2656 BNF = never,
2657 CRF = never,
2658 CJF = never,
2659 CNF = never,
2660 RRF = never,
2661 RJF = never,
2662 RNF = never,
2663 >(
2664 failFilter?:
2665 | ((
2666 t: TJ,
2667 u: UJ,
2668 v: VJ,
2669 ...s: SJ[]
2670 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF)
2671 | null,
2672 ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
2673 }
2674
2675 /**
2676 * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred.
2677 * @see \`{@link https://api.jquery.com/Types/#Promise }\`
2678 */
2679 interface Promise3<TR, TJ, TN, UR, UJ, UN, VR, VJ, VN>
2680 extends PromiseBase<TR, TJ, TN, UR, UJ, UN, VR, VJ, VN, never, never, never>
2681 {}
2682
2683 /**
2684 * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred.
2685 * @see \`{@link https://api.jquery.com/Types/#Promise }\`
2686 */
2687 interface Promise2<TR, TJ, TN, UR, UJ, UN>
2688 extends PromiseBase<TR, TJ, TN, UR, UJ, UN, never, never, never, never, never, never>
2689 {}
2690
2691 /**
2692 * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred.
2693 * @see \`{@link https://api.jquery.com/Types/#Promise }\`
2694 */
2695 interface Promise<TR, TJ = any, TN = any> extends PromiseBase<TR, TJ, TN, TR, TJ, TN, TR, TJ, TN, TR, TJ, TN> {}
2696
2697 interface DeferredStatic {
2698 // https://jquery.com/upgrade-guide/3.0/#callback-exit
2699 exceptionHook: any;
2700 /**
2701 * A factory function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.
2702 * @param beforeStart A function that is called just before the constructor returns.
2703 * @see \`{@link https://api.jquery.com/jQuery.Deferred/ }\`
2704 * @since 1.5
2705 */
2706 <TR = any, TJ = any, TN = any>(
2707 beforeStart?: (this: Deferred<TR, TJ, TN>, deferred: Deferred<TR, TJ, TN>) => void,
2708 ): Deferred<TR, TJ, TN>;
2709 }
2710
2711 interface Deferred<TR, TJ = any, TN = any> {
2712 /**
2713 * Call the progressCallbacks on a Deferred object with the given args.
2714 * @param args Optional arguments that are passed to the progressCallbacks.
2715 * @see \`{@link https://api.jquery.com/deferred.notify/ }\`
2716 * @since 1.7
2717 */
2718 notify(...args: TN[]): this;
2719 /**
2720 * Call the progressCallbacks on a Deferred object with the given context and args.
2721 * @param context Context passed to the progressCallbacks as the this object.
2722 * @param args An optional array of arguments that are passed to the progressCallbacks.
2723 * @see \`{@link https://api.jquery.com/deferred.notifyWith/ }\`
2724 * @since 1.7
2725 */
2726 notifyWith(context: object, args?: ArrayLike<TN>): this;
2727 /**
2728 * Reject a Deferred object and call any failCallbacks with the given args.
2729 * @param args Optional arguments that are passed to the failCallbacks.
2730 * @see \`{@link https://api.jquery.com/deferred.reject/ }\`
2731 * @since 1.5
2732 */
2733 reject(...args: TJ[]): this;
2734 /**
2735 * Reject a Deferred object and call any failCallbacks with the given context and args.
2736 * @param context Context passed to the failCallbacks as the this object.
2737 * @param args An optional array of arguments that are passed to the failCallbacks.
2738 * @see \`{@link https://api.jquery.com/deferred.rejectWith/ }\`
2739 * @since 1.5
2740 */
2741 rejectWith(context: object, args?: ArrayLike<TJ>): this;
2742 /**
2743 * Resolve a Deferred object and call any doneCallbacks with the given args.
2744 * @param args Optional arguments that are passed to the doneCallbacks.
2745 * @see \`{@link https://api.jquery.com/deferred.resolve/ }\`
2746 * @since 1.5
2747 */
2748 resolve(...args: TR[]): this;
2749 /**
2750 * Resolve a Deferred object and call any doneCallbacks with the given context and args.
2751 * @param context Context passed to the doneCallbacks as the this object.
2752 * @param args An optional array of arguments that are passed to the doneCallbacks.
2753 * @see \`{@link https://api.jquery.com/deferred.resolveWith/ }\`
2754 * @since 1.5
2755 */
2756 resolveWith(context: object, args?: ArrayLike<TR>): this;
2757
2758 /**
2759 * Add handlers to be called when the Deferred object is either resolved or rejected.
2760 * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected.
2761 * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
2762 * @see \`{@link https://api.jquery.com/deferred.always/ }\`
2763 * @since 1.6
2764 * @example ​ ````Since the jQuery.get() method returns a jqXHR object, which is derived from a Deferred object, we can attach a callback for both success and error using the deferred.always() method.
2765```javascript
2766$.get( "test.php" ).always(function() {
2767 alert( "$.get completed with success or error callback arguments" );
2768});
2769```
2770 */
2771 always(
2772 alwaysCallback: TypeOrArray<Deferred.Callback<TR | TJ>>,
2773 ...alwaysCallbacks: Array<TypeOrArray<Deferred.Callback<TR | TJ>>>
2774 ): this;
2775 /**
2776 * Add handlers to be called when the Deferred object is resolved.
2777 * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved.
2778 * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
2779 * @see \`{@link https://api.jquery.com/deferred.done/ }\`
2780 * @since 1.5
2781 * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach a success callback using the .done() method.
2782```javascript
2783$.get( "test.php" ).done(function() {
2784 alert( "$.get succeeded" );
2785});
2786```
2787 * @example ​ ````Resolve a Deferred object when the user clicks a button, triggering a number of callback functions:
2788```html
2789<!doctype html>
2790<html lang="en">
2791<head>
2792 <meta charset="utf-8">
2793 <title>deferred.done demo</title>
2794 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
2795</head>
2796<body>
2797
2798<button>Go</button>
2799<p>Ready...</p>
2800
2801<script>
2802// 3 functions to call when the Deferred object is resolved
2803function fn1() {
2804 $( "p" ).append( " 1 " );
2805}
2806function fn2() {
2807 $( "p" ).append( " 2 " );
2808}
2809function fn3( n ) {
2810 $( "p" ).append( n + " 3 " + n );
2811}
2812
2813// Create a deferred object
2814var dfd = $.Deferred();
2815
2816// Add handlers to be called when dfd is resolved
2817dfd
2818// .done() can take any number of functions or arrays of functions
2819 .done( [ fn1, fn2 ], fn3, [ fn2, fn1 ] )
2820// We can chain done methods, too
2821 .done(function( n ) {
2822 $( "p" ).append( n + " we're done." );
2823 });
2824
2825// Resolve the Deferred object when the button is clicked
2826$( "button" ).on( "click", function() {
2827 dfd.resolve( "and" );
2828});
2829</script>
2830
2831</body>
2832</html>
2833```
2834 */
2835 done(
2836 doneCallback: TypeOrArray<Deferred.Callback<TR>>,
2837 ...doneCallbacks: Array<TypeOrArray<Deferred.Callback<TR>>>
2838 ): this;
2839 /**
2840 * Add handlers to be called when the Deferred object is rejected.
2841 * @param failCallback A function, or array of functions, that are called when the Deferred is rejected.
2842 * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
2843 * @see \`{@link https://api.jquery.com/deferred.fail/ }\`
2844 * @since 1.5
2845 * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred, you can attach a success and failure callback using the deferred.done() and deferred.fail() methods.
2846```javascript
2847$.get( "test.php" )
2848 .done(function() {
2849 alert( "$.get succeeded" );
2850 })
2851 .fail(function() {
2852 alert( "$.get failed!" );
2853 });
2854```
2855 */
2856 fail(
2857 failCallback: TypeOrArray<Deferred.Callback<TJ>>,
2858 ...failCallbacks: Array<TypeOrArray<Deferred.Callback<TJ>>>
2859 ): this;
2860 /**
2861 * Add handlers to be called when the Deferred object generates progress notifications.
2862 * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications.
2863 * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates
2864 * progress notifications.
2865 * @see \`{@link https://api.jquery.com/deferred.progress/ }\`
2866 * @since 1.7
2867 */
2868 progress(
2869 progressCallback: TypeOrArray<Deferred.Callback<TN>>,
2870 ...progressCallbacks: Array<TypeOrArray<Deferred.Callback<TN>>>
2871 ): this;
2872 /**
2873 * Return a Deferred's Promise object.
2874 * @param target Object onto which the promise methods have to be attached
2875 * @see \`{@link https://api.jquery.com/deferred.promise/ }\`
2876 * @since 1.5
2877 * @example ​ ````Use the target argument to promote an existing object to a Promise:
2878```javascript
2879// Existing object
2880var obj = {
2881 hello: function( name ) {
2882 alert( "Hello " + name );
2883 }
2884 },
2885 // Create a Deferred
2886 defer = $.Deferred();
2887
2888// Set object as a promise
2889defer.promise( obj );
2890
2891// Resolve the deferred
2892defer.resolve( "John" );
2893
2894// Use the object as a Promise
2895obj.done(function( name ) {
2896 obj.hello( name ); // Will alert "Hello John"
2897}).hello( "Karl" ); // Will alert "Hello Karl"
2898```
2899 */
2900 promise<TTarget extends object>(target: TTarget): Promise<TR, TJ, TN> & TTarget;
2901 /**
2902 * Return a Deferred's Promise object.
2903 * @see \`{@link https://api.jquery.com/deferred.promise/ }\`
2904 * @since 1.5
2905 * @example ​ ````Create a Deferred and set two timer-based functions to either resolve or reject the Deferred after a random interval. Whichever one fires first &quot;wins&quot; and will call one of the callbacks. The second timeout has no effect since the Deferred is already complete (in a resolved or rejected state) from the first timeout action. Also set a timer-based progress notification function, and call a progress handler that adds &quot;working...&quot; to the document body.
2906```javascript
2907function asyncEvent() {
2908 var dfd = jQuery.Deferred();
2909
2910 // Resolve after a random interval
2911 setTimeout(function() {
2912 dfd.resolve( "hurray" );
2913 }, Math.floor( 400 + Math.random() * 2000 ) );
2914
2915 // Reject after a random interval
2916 setTimeout(function() {
2917 dfd.reject( "sorry" );
2918 }, Math.floor( 400 + Math.random() * 2000 ) );
2919
2920 // Show a "working..." message every half-second
2921 setTimeout(function working() {
2922 if ( dfd.state() === "pending" ) {
2923 dfd.notify( "working... " );
2924 setTimeout( working, 500 );
2925 }
2926 }, 1 );
2927
2928 // Return the Promise so caller can't change the Deferred
2929 return dfd.promise();
2930}
2931
2932// Attach a done, fail, and progress handler for the asyncEvent
2933$.when( asyncEvent() ).then(
2934 function( status ) {
2935 alert( status + ", things are going well" );
2936 },
2937 function( status ) {
2938 alert( status + ", you fail this time" );
2939 },
2940 function( status ) {
2941 $( "body" ).append( status );
2942 }
2943);
2944```
2945 */
2946 promise(): Promise<TR, TJ, TN>;
2947 /**
2948 * Determine the current state of a Deferred object.
2949 * @see \`{@link https://api.jquery.com/deferred.state/ }\`
2950 * @since 1.7
2951 */
2952 state(): "pending" | "resolved" | "rejected";
2953
2954 // region pipe
2955 // #region pipe
2956
2957 /**
2958 * Utility method to filter and/or chain Deferreds.
2959 * @param doneFilter An optional function that is called when the Deferred is resolved.
2960 * @param failFilter An optional function that is called when the Deferred is rejected.
2961 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
2962 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
2963 * @since 1.6
2964 * @since 1.7
2965 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
2966 *
2967 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
2968 *
2969 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
2970 * @example ​ ````Filter resolve value:
2971```javascript
2972var defer = $.Deferred(),
2973 filtered = defer.pipe(function( value ) {
2974 return value * 2;
2975 });
2976
2977defer.resolve( 5 );
2978filtered.done(function( value ) {
2979 alert( "Value is ( 2*5 = ) 10: " + value );
2980});
2981```
2982 * @example ​ ````Filter reject value:
2983```javascript
2984var defer = $.Deferred(),
2985 filtered = defer.pipe( null, function( value ) {
2986 return value * 3;
2987 });
2988
2989defer.reject( 6 );
2990filtered.fail(function( value ) {
2991 alert( "Value is ( 3*6 = ) 18: " + value );
2992});
2993```
2994 * @example ​ ````Chain tasks:
2995```javascript
2996var request = $.ajax( url, { dataType: "json" } ),
2997 chained = request.pipe(function( data ) {
2998 return $.ajax( url2, { data: { user: data.userId } } );
2999 });
3000
3001chained.done(function( data ) {
3002 // data retrieved from url2 as provided by the first request
3003});
3004```
3005 */
3006 pipe<
3007 ARD = never,
3008 AJD = never,
3009 AND = never,
3010 BRD = never,
3011 BJD = never,
3012 BND = never,
3013 CRD = never,
3014 CJD = never,
3015 CND = never,
3016 RRD = never,
3017 RJD = never,
3018 RND = never,
3019 ARF = never,
3020 AJF = never,
3021 ANF = never,
3022 BRF = never,
3023 BJF = never,
3024 BNF = never,
3025 CRF = never,
3026 CJF = never,
3027 CNF = never,
3028 RRF = never,
3029 RJF = never,
3030 RNF = never,
3031 ARP = never,
3032 AJP = never,
3033 ANP = never,
3034 BRP = never,
3035 BJP = never,
3036 BNP = never,
3037 CRP = never,
3038 CJP = never,
3039 CNP = never,
3040 RRP = never,
3041 RJP = never,
3042 RNP = never,
3043 >(
3044 doneFilter: (
3045 ...t: TR[]
3046 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
3047 failFilter: (
3048 ...t: TJ[]
3049 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
3050 progressFilter: (
3051 ...t: TN[]
3052 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
3053 ): PromiseBase<
3054 ARD | ARF | ARP,
3055 AJD | AJF | AJP,
3056 AND | ANF | ANP,
3057 BRD | BRF | BRP,
3058 BJD | BJF | BJP,
3059 BND | BNF | BNP,
3060 CRD | CRF | CRP,
3061 CJD | CJF | CJP,
3062 CND | CNF | CNP,
3063 RRD | RRF | RRP,
3064 RJD | RJF | RJP,
3065 RND | RNF | RNP
3066 >;
3067 /**
3068 * Utility method to filter and/or chain Deferreds.
3069 * @param doneFilter An optional function that is called when the Deferred is resolved.
3070 * @param failFilter An optional function that is called when the Deferred is rejected.
3071 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3072 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
3073 * @since 1.6
3074 * @since 1.7
3075 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
3076 *
3077 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
3078 *
3079 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
3080 * @example ​ ````Filter reject value:
3081```javascript
3082var defer = $.Deferred(),
3083 filtered = defer.pipe( null, function( value ) {
3084 return value * 3;
3085 });
3086
3087defer.reject( 6 );
3088filtered.fail(function( value ) {
3089 alert( "Value is ( 3*6 = ) 18: " + value );
3090});
3091```
3092 * @example ​ ````Chain tasks:
3093```javascript
3094var request = $.ajax( url, { dataType: "json" } ),
3095 chained = request.pipe(function( data ) {
3096 return $.ajax( url2, { data: { user: data.userId } } );
3097 });
3098
3099chained.done(function( data ) {
3100 // data retrieved from url2 as provided by the first request
3101});
3102```
3103 */
3104 pipe<
3105 ARF = never,
3106 AJF = never,
3107 ANF = never,
3108 BRF = never,
3109 BJF = never,
3110 BNF = never,
3111 CRF = never,
3112 CJF = never,
3113 CNF = never,
3114 RRF = never,
3115 RJF = never,
3116 RNF = never,
3117 ARP = never,
3118 AJP = never,
3119 ANP = never,
3120 BRP = never,
3121 BJP = never,
3122 BNP = never,
3123 CRP = never,
3124 CJP = never,
3125 CNP = never,
3126 RRP = never,
3127 RJP = never,
3128 RNP = never,
3129 >(
3130 doneFilter: null,
3131 failFilter: (
3132 ...t: TJ[]
3133 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
3134 progressFilter: (
3135 ...t: TN[]
3136 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
3137 ): PromiseBase<
3138 ARF | ARP,
3139 AJF | AJP,
3140 ANF | ANP,
3141 BRF | BRP,
3142 BJF | BJP,
3143 BNF | BNP,
3144 CRF | CRP,
3145 CJF | CJP,
3146 CNF | CNP,
3147 RRF | RRP,
3148 RJF | RJP,
3149 RNF | RNP
3150 >;
3151 /**
3152 * Utility method to filter and/or chain Deferreds.
3153 * @param doneFilter An optional function that is called when the Deferred is resolved.
3154 * @param failFilter An optional function that is called when the Deferred is rejected.
3155 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3156 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
3157 * @since 1.6
3158 * @since 1.7
3159 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
3160 *
3161 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
3162 *
3163 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
3164 * @example ​ ````Filter resolve value:
3165```javascript
3166var defer = $.Deferred(),
3167 filtered = defer.pipe(function( value ) {
3168 return value * 2;
3169 });
3170
3171defer.resolve( 5 );
3172filtered.done(function( value ) {
3173 alert( "Value is ( 2*5 = ) 10: " + value );
3174});
3175```
3176 * @example ​ ````Chain tasks:
3177```javascript
3178var request = $.ajax( url, { dataType: "json" } ),
3179 chained = request.pipe(function( data ) {
3180 return $.ajax( url2, { data: { user: data.userId } } );
3181 });
3182
3183chained.done(function( data ) {
3184 // data retrieved from url2 as provided by the first request
3185});
3186```
3187 */
3188 pipe<
3189 ARD = never,
3190 AJD = never,
3191 AND = never,
3192 BRD = never,
3193 BJD = never,
3194 BND = never,
3195 CRD = never,
3196 CJD = never,
3197 CND = never,
3198 RRD = never,
3199 RJD = never,
3200 RND = never,
3201 ARP = never,
3202 AJP = never,
3203 ANP = never,
3204 BRP = never,
3205 BJP = never,
3206 BNP = never,
3207 CRP = never,
3208 CJP = never,
3209 CNP = never,
3210 RRP = never,
3211 RJP = never,
3212 RNP = never,
3213 >(
3214 doneFilter: (
3215 ...t: TR[]
3216 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
3217 failFilter: null,
3218 progressFilter: (
3219 ...t: TN[]
3220 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
3221 ): PromiseBase<
3222 ARD | ARP,
3223 AJD | AJP,
3224 AND | ANP,
3225 BRD | BRP,
3226 BJD | BJP,
3227 BND | BNP,
3228 CRD | CRP,
3229 CJD | CJP,
3230 CND | CNP,
3231 RRD | RRP,
3232 RJD | RJP,
3233 RND | RNP
3234 >;
3235 /**
3236 * Utility method to filter and/or chain Deferreds.
3237 * @param doneFilter An optional function that is called when the Deferred is resolved.
3238 * @param failFilter An optional function that is called when the Deferred is rejected.
3239 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3240 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
3241 * @since 1.6
3242 * @since 1.7
3243 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
3244 *
3245 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
3246 *
3247 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
3248 * @example ​ ````Chain tasks:
3249```javascript
3250var request = $.ajax( url, { dataType: "json" } ),
3251 chained = request.pipe(function( data ) {
3252 return $.ajax( url2, { data: { user: data.userId } } );
3253 });
3254
3255chained.done(function( data ) {
3256 // data retrieved from url2 as provided by the first request
3257});
3258```
3259 */
3260 pipe<
3261 ARP = never,
3262 AJP = never,
3263 ANP = never,
3264 BRP = never,
3265 BJP = never,
3266 BNP = never,
3267 CRP = never,
3268 CJP = never,
3269 CNP = never,
3270 RRP = never,
3271 RJP = never,
3272 RNP = never,
3273 >(
3274 doneFilter: null,
3275 failFilter: null,
3276 progressFilter?: (
3277 ...t: TN[]
3278 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
3279 ): PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP>;
3280 /**
3281 * Utility method to filter and/or chain Deferreds.
3282 * @param doneFilter An optional function that is called when the Deferred is resolved.
3283 * @param failFilter An optional function that is called when the Deferred is rejected.
3284 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3285 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
3286 * @since 1.6
3287 * @since 1.7
3288 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
3289 *
3290 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
3291 *
3292 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
3293 * @example ​ ````Filter resolve value:
3294```javascript
3295var defer = $.Deferred(),
3296 filtered = defer.pipe(function( value ) {
3297 return value * 2;
3298 });
3299
3300defer.resolve( 5 );
3301filtered.done(function( value ) {
3302 alert( "Value is ( 2*5 = ) 10: " + value );
3303});
3304```
3305 * @example ​ ````Filter reject value:
3306```javascript
3307var defer = $.Deferred(),
3308 filtered = defer.pipe( null, function( value ) {
3309 return value * 3;
3310 });
3311
3312defer.reject( 6 );
3313filtered.fail(function( value ) {
3314 alert( "Value is ( 3*6 = ) 18: " + value );
3315});
3316```
3317 * @example ​ ````Chain tasks:
3318```javascript
3319var request = $.ajax( url, { dataType: "json" } ),
3320 chained = request.pipe(function( data ) {
3321 return $.ajax( url2, { data: { user: data.userId } } );
3322 });
3323
3324chained.done(function( data ) {
3325 // data retrieved from url2 as provided by the first request
3326});
3327```
3328 */
3329 pipe<
3330 ARD = never,
3331 AJD = never,
3332 AND = never,
3333 BRD = never,
3334 BJD = never,
3335 BND = never,
3336 CRD = never,
3337 CJD = never,
3338 CND = never,
3339 RRD = never,
3340 RJD = never,
3341 RND = never,
3342 ARF = never,
3343 AJF = never,
3344 ANF = never,
3345 BRF = never,
3346 BJF = never,
3347 BNF = never,
3348 CRF = never,
3349 CJF = never,
3350 CNF = never,
3351 RRF = never,
3352 RJF = never,
3353 RNF = never,
3354 >(
3355 doneFilter: (
3356 ...t: TR[]
3357 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
3358 failFilter: (
3359 ...t: TJ[]
3360 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
3361 progressFilter?: null,
3362 ): PromiseBase<
3363 ARD | ARF,
3364 AJD | AJF,
3365 AND | ANF,
3366 BRD | BRF,
3367 BJD | BJF,
3368 BND | BNF,
3369 CRD | CRF,
3370 CJD | CJF,
3371 CND | CNF,
3372 RRD | RRF,
3373 RJD | RJF,
3374 RND | RNF
3375 >;
3376 /**
3377 * Utility method to filter and/or chain Deferreds.
3378 * @param doneFilter An optional function that is called when the Deferred is resolved.
3379 * @param failFilter An optional function that is called when the Deferred is rejected.
3380 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3381 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
3382 * @since 1.6
3383 * @since 1.7
3384 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
3385 *
3386 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
3387 *
3388 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
3389 * @example ​ ````Filter reject value:
3390```javascript
3391var defer = $.Deferred(),
3392 filtered = defer.pipe( null, function( value ) {
3393 return value * 3;
3394 });
3395
3396defer.reject( 6 );
3397filtered.fail(function( value ) {
3398 alert( "Value is ( 3*6 = ) 18: " + value );
3399});
3400```
3401 * @example ​ ````Chain tasks:
3402```javascript
3403var request = $.ajax( url, { dataType: "json" } ),
3404 chained = request.pipe(function( data ) {
3405 return $.ajax( url2, { data: { user: data.userId } } );
3406 });
3407
3408chained.done(function( data ) {
3409 // data retrieved from url2 as provided by the first request
3410});
3411```
3412 */
3413 pipe<
3414 ARF = never,
3415 AJF = never,
3416 ANF = never,
3417 BRF = never,
3418 BJF = never,
3419 BNF = never,
3420 CRF = never,
3421 CJF = never,
3422 CNF = never,
3423 RRF = never,
3424 RJF = never,
3425 RNF = never,
3426 >(
3427 doneFilter: null,
3428 failFilter: (
3429 ...t: TJ[]
3430 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
3431 progressFilter?: null,
3432 ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
3433 /**
3434 * Utility method to filter and/or chain Deferreds.
3435 * @param doneFilter An optional function that is called when the Deferred is resolved.
3436 * @param failFilter An optional function that is called when the Deferred is rejected.
3437 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3438 * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
3439 * @since 1.6
3440 * @since 1.7
3441 * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
3442 *
3443 * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
3444 *
3445 * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
3446 * @example ​ ````Filter resolve value:
3447```javascript
3448var defer = $.Deferred(),
3449 filtered = defer.pipe(function( value ) {
3450 return value * 2;
3451 });
3452
3453defer.resolve( 5 );
3454filtered.done(function( value ) {
3455 alert( "Value is ( 2*5 = ) 10: " + value );
3456});
3457```
3458 * @example ​ ````Chain tasks:
3459```javascript
3460var request = $.ajax( url, { dataType: "json" } ),
3461 chained = request.pipe(function( data ) {
3462 return $.ajax( url2, { data: { user: data.userId } } );
3463 });
3464
3465chained.done(function( data ) {
3466 // data retrieved from url2 as provided by the first request
3467});
3468```
3469 */
3470 pipe<
3471 ARD = never,
3472 AJD = never,
3473 AND = never,
3474 BRD = never,
3475 BJD = never,
3476 BND = never,
3477 CRD = never,
3478 CJD = never,
3479 CND = never,
3480 RRD = never,
3481 RJD = never,
3482 RND = never,
3483 >(
3484 doneFilter: (
3485 ...t: TR[]
3486 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
3487 failFilter?: null,
3488 progressFilter?: null,
3489 ): PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND>;
3490
3491 // #endregion
3492
3493 // region then
3494 // #region then
3495
3496 /**
3497 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
3498 * @param doneFilter A function that is called when the Deferred is resolved.
3499 * @param failFilter An optional function that is called when the Deferred is rejected.
3500 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3501 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
3502 * @since 1.8
3503 * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method.
3504```javascript
3505$.get( "test.php" ).then(
3506 function() {
3507 alert( "$.get succeeded" );
3508 }, function() {
3509 alert( "$.get failed!" );
3510 }
3511);
3512```
3513 * @example ​ ````Filter the resolve value:
3514```html
3515<!doctype html>
3516<html lang="en">
3517<head>
3518 <meta charset="utf-8">
3519 <title>deferred.then demo</title>
3520 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3521</head>
3522<body>
3523
3524<button>Filter Resolve</button>
3525<p></p>
3526
3527<script>
3528var filterResolve = function() {
3529 var defer = $.Deferred(),
3530 filtered = defer.then(function( value ) {
3531 return value * 2;
3532 });
3533
3534 defer.resolve( 5 );
3535 filtered.done(function( value ) {
3536 $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
3537 });
3538};
3539
3540$( "button" ).on( "click", filterResolve );
3541</script>
3542
3543</body>
3544</html>
3545```
3546 * @example ​ ````Filter reject value:
3547```javascript
3548var defer = $.Deferred(),
3549 filtered = defer.then( null, function( value ) {
3550 return value * 3;
3551 });
3552
3553defer.reject( 6 );
3554filtered.fail(function( value ) {
3555 alert( "Value is ( 3*6 = ) 18: " + value );
3556});
3557```
3558 * @example ​ ````Chain tasks:
3559```javascript
3560var request = $.ajax( url, { dataType: "json" } ),
3561 chained = request.then(function( data ) {
3562 return $.ajax( url2, { data: { user: data.userId } } );
3563 });
3564
3565chained.done(function( data ) {
3566 // data retrieved from url2 as provided by the first request
3567});
3568```
3569 */
3570 then<
3571 ARD = never,
3572 AJD = never,
3573 AND = never,
3574 BRD = never,
3575 BJD = never,
3576 BND = never,
3577 CRD = never,
3578 CJD = never,
3579 CND = never,
3580 RRD = never,
3581 RJD = never,
3582 RND = never,
3583 ARF = never,
3584 AJF = never,
3585 ANF = never,
3586 BRF = never,
3587 BJF = never,
3588 BNF = never,
3589 CRF = never,
3590 CJF = never,
3591 CNF = never,
3592 RRF = never,
3593 RJF = never,
3594 RNF = never,
3595 ARP = never,
3596 AJP = never,
3597 ANP = never,
3598 BRP = never,
3599 BJP = never,
3600 BNP = never,
3601 CRP = never,
3602 CJP = never,
3603 CNP = never,
3604 RRP = never,
3605 RJP = never,
3606 RNP = never,
3607 >(
3608 doneFilter: (
3609 ...t: TR[]
3610 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
3611 failFilter: (
3612 ...t: TJ[]
3613 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
3614 progressFilter: (
3615 ...t: TN[]
3616 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
3617 ): PromiseBase<
3618 ARD | ARF | ARP,
3619 AJD | AJF | AJP,
3620 AND | ANF | ANP,
3621 BRD | BRF | BRP,
3622 BJD | BJF | BJP,
3623 BND | BNF | BNP,
3624 CRD | CRF | CRP,
3625 CJD | CJF | CJP,
3626 CND | CNF | CNP,
3627 RRD | RRF | RRP,
3628 RJD | RJF | RJP,
3629 RND | RNF | RNP
3630 >;
3631 /**
3632 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
3633 * @param doneFilter A function that is called when the Deferred is resolved.
3634 * @param failFilter An optional function that is called when the Deferred is rejected.
3635 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3636 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
3637 * @since 1.8
3638 * @example ​ ````Filter reject value:
3639```javascript
3640var defer = $.Deferred(),
3641 filtered = defer.then( null, function( value ) {
3642 return value * 3;
3643 });
3644
3645defer.reject( 6 );
3646filtered.fail(function( value ) {
3647 alert( "Value is ( 3*6 = ) 18: " + value );
3648});
3649```
3650 * @example ​ ````Chain tasks:
3651```javascript
3652var request = $.ajax( url, { dataType: "json" } ),
3653 chained = request.then(function( data ) {
3654 return $.ajax( url2, { data: { user: data.userId } } );
3655 });
3656
3657chained.done(function( data ) {
3658 // data retrieved from url2 as provided by the first request
3659});
3660```
3661 */
3662 then<
3663 ARF = never,
3664 AJF = never,
3665 ANF = never,
3666 BRF = never,
3667 BJF = never,
3668 BNF = never,
3669 CRF = never,
3670 CJF = never,
3671 CNF = never,
3672 RRF = never,
3673 RJF = never,
3674 RNF = never,
3675 ARP = never,
3676 AJP = never,
3677 ANP = never,
3678 BRP = never,
3679 BJP = never,
3680 BNP = never,
3681 CRP = never,
3682 CJP = never,
3683 CNP = never,
3684 RRP = never,
3685 RJP = never,
3686 RNP = never,
3687 >(
3688 doneFilter: null,
3689 failFilter: (
3690 ...t: TJ[]
3691 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
3692 progressFilter: (
3693 ...t: TN[]
3694 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
3695 ): PromiseBase<
3696 ARF | ARP,
3697 AJF | AJP,
3698 ANF | ANP,
3699 BRF | BRP,
3700 BJF | BJP,
3701 BNF | BNP,
3702 CRF | CRP,
3703 CJF | CJP,
3704 CNF | CNP,
3705 RRF | RRP,
3706 RJF | RJP,
3707 RNF | RNP
3708 >;
3709 /**
3710 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
3711 * @param doneFilter A function that is called when the Deferred is resolved.
3712 * @param failFilter An optional function that is called when the Deferred is rejected.
3713 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3714 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
3715 * @since 1.8
3716 * @example ​ ````Filter the resolve value:
3717```html
3718<!doctype html>
3719<html lang="en">
3720<head>
3721 <meta charset="utf-8">
3722 <title>deferred.then demo</title>
3723 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3724</head>
3725<body>
3726
3727<button>Filter Resolve</button>
3728<p></p>
3729
3730<script>
3731var filterResolve = function() {
3732 var defer = $.Deferred(),
3733 filtered = defer.then(function( value ) {
3734 return value * 2;
3735 });
3736
3737 defer.resolve( 5 );
3738 filtered.done(function( value ) {
3739 $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
3740 });
3741};
3742
3743$( "button" ).on( "click", filterResolve );
3744</script>
3745
3746</body>
3747</html>
3748```
3749 * @example ​ ````Chain tasks:
3750```javascript
3751var request = $.ajax( url, { dataType: "json" } ),
3752 chained = request.then(function( data ) {
3753 return $.ajax( url2, { data: { user: data.userId } } );
3754 });
3755
3756chained.done(function( data ) {
3757 // data retrieved from url2 as provided by the first request
3758});
3759```
3760 */
3761 then<
3762 ARD = never,
3763 AJD = never,
3764 AND = never,
3765 BRD = never,
3766 BJD = never,
3767 BND = never,
3768 CRD = never,
3769 CJD = never,
3770 CND = never,
3771 RRD = never,
3772 RJD = never,
3773 RND = never,
3774 ARP = never,
3775 AJP = never,
3776 ANP = never,
3777 BRP = never,
3778 BJP = never,
3779 BNP = never,
3780 CRP = never,
3781 CJP = never,
3782 CNP = never,
3783 RRP = never,
3784 RJP = never,
3785 RNP = never,
3786 >(
3787 doneFilter: (
3788 ...t: TR[]
3789 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
3790 failFilter: null,
3791 progressFilter: (
3792 ...t: TN[]
3793 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
3794 ): PromiseBase<
3795 ARD | ARP,
3796 AJD | AJP,
3797 AND | ANP,
3798 BRD | BRP,
3799 BJD | BJP,
3800 BND | BNP,
3801 CRD | CRP,
3802 CJD | CJP,
3803 CND | CNP,
3804 RRD | RRP,
3805 RJD | RJP,
3806 RND | RNP
3807 >;
3808 /**
3809 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
3810 * @param doneFilter A function that is called when the Deferred is resolved.
3811 * @param failFilter An optional function that is called when the Deferred is rejected.
3812 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3813 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
3814 * @since 1.8
3815 * @example ​ ````Chain tasks:
3816```javascript
3817var request = $.ajax( url, { dataType: "json" } ),
3818 chained = request.then(function( data ) {
3819 return $.ajax( url2, { data: { user: data.userId } } );
3820 });
3821
3822chained.done(function( data ) {
3823 // data retrieved from url2 as provided by the first request
3824});
3825```
3826 */
3827 then<
3828 ARP = never,
3829 AJP = never,
3830 ANP = never,
3831 BRP = never,
3832 BJP = never,
3833 BNP = never,
3834 CRP = never,
3835 CJP = never,
3836 CNP = never,
3837 RRP = never,
3838 RJP = never,
3839 RNP = never,
3840 >(
3841 doneFilter: null,
3842 failFilter: null,
3843 progressFilter?: (
3844 ...t: TN[]
3845 ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
3846 ): PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP>;
3847 /**
3848 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
3849 * @param doneFilter An optional function that is called when the Deferred is resolved.
3850 * @param failFilter An optional function that is called when the Deferred is rejected.
3851 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3852 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
3853 * @since 1.8
3854 * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method.
3855```javascript
3856$.get( "test.php" ).then(
3857 function() {
3858 alert( "$.get succeeded" );
3859 }, function() {
3860 alert( "$.get failed!" );
3861 }
3862);
3863```
3864 * @example ​ ````Filter the resolve value:
3865```html
3866<!doctype html>
3867<html lang="en">
3868<head>
3869 <meta charset="utf-8">
3870 <title>deferred.then demo</title>
3871 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
3872</head>
3873<body>
3874
3875<button>Filter Resolve</button>
3876<p></p>
3877
3878<script>
3879var filterResolve = function() {
3880 var defer = $.Deferred(),
3881 filtered = defer.then(function( value ) {
3882 return value * 2;
3883 });
3884
3885 defer.resolve( 5 );
3886 filtered.done(function( value ) {
3887 $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
3888 });
3889};
3890
3891$( "button" ).on( "click", filterResolve );
3892</script>
3893
3894</body>
3895</html>
3896```
3897 * @example ​ ````Filter reject value:
3898```javascript
3899var defer = $.Deferred(),
3900 filtered = defer.then( null, function( value ) {
3901 return value * 3;
3902 });
3903
3904defer.reject( 6 );
3905filtered.fail(function( value ) {
3906 alert( "Value is ( 3*6 = ) 18: " + value );
3907});
3908```
3909 * @example ​ ````Chain tasks:
3910```javascript
3911var request = $.ajax( url, { dataType: "json" } ),
3912 chained = request.then(function( data ) {
3913 return $.ajax( url2, { data: { user: data.userId } } );
3914 });
3915
3916chained.done(function( data ) {
3917 // data retrieved from url2 as provided by the first request
3918});
3919```
3920 */
3921 then<
3922 ARD = never,
3923 AJD = never,
3924 AND = never,
3925 BRD = never,
3926 BJD = never,
3927 BND = never,
3928 CRD = never,
3929 CJD = never,
3930 CND = never,
3931 RRD = never,
3932 RJD = never,
3933 RND = never,
3934 ARF = never,
3935 AJF = never,
3936 ANF = never,
3937 BRF = never,
3938 BJF = never,
3939 BNF = never,
3940 CRF = never,
3941 CJF = never,
3942 CNF = never,
3943 RRF = never,
3944 RJF = never,
3945 RNF = never,
3946 >(
3947 doneFilter: (
3948 ...t: TR[]
3949 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
3950 failFilter: (
3951 ...t: TJ[]
3952 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
3953 progressFilter?: null,
3954 ): PromiseBase<
3955 ARD | ARF,
3956 AJD | AJF,
3957 AND | ANF,
3958 BRD | BRF,
3959 BJD | BJF,
3960 BND | BNF,
3961 CRD | CRF,
3962 CJD | CJF,
3963 CND | CNF,
3964 RRD | RRF,
3965 RJD | RJF,
3966 RND | RNF
3967 >;
3968 /**
3969 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
3970 * @param doneFilter An optional function that is called when the Deferred is resolved.
3971 * @param failFilter An optional function that is called when the Deferred is rejected.
3972 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
3973 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
3974 * @since 1.8
3975 * @example ​ ````Filter reject value:
3976```javascript
3977var defer = $.Deferred(),
3978 filtered = defer.then( null, function( value ) {
3979 return value * 3;
3980 });
3981
3982defer.reject( 6 );
3983filtered.fail(function( value ) {
3984 alert( "Value is ( 3*6 = ) 18: " + value );
3985});
3986```
3987 * @example ​ ````Chain tasks:
3988```javascript
3989var request = $.ajax( url, { dataType: "json" } ),
3990 chained = request.then(function( data ) {
3991 return $.ajax( url2, { data: { user: data.userId } } );
3992 });
3993
3994chained.done(function( data ) {
3995 // data retrieved from url2 as provided by the first request
3996});
3997```
3998 */
3999 then<
4000 ARF = never,
4001 AJF = never,
4002 ANF = never,
4003 BRF = never,
4004 BJF = never,
4005 BNF = never,
4006 CRF = never,
4007 CJF = never,
4008 CNF = never,
4009 RRF = never,
4010 RJF = never,
4011 RNF = never,
4012 >(
4013 doneFilter: null,
4014 failFilter: (
4015 ...t: TJ[]
4016 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
4017 progressFilter?: null,
4018 ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
4019 /**
4020 * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
4021 * @param doneFilter An optional function that is called when the Deferred is resolved.
4022 * @param failFilter An optional function that is called when the Deferred is rejected.
4023 * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
4024 * @see \`{@link https://api.jquery.com/deferred.then/ }\`
4025 * @since 1.8
4026 * @example ​ ````Filter the resolve value:
4027```html
4028<!doctype html>
4029<html lang="en">
4030<head>
4031 <meta charset="utf-8">
4032 <title>deferred.then demo</title>
4033 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4034</head>
4035<body>
4036
4037<button>Filter Resolve</button>
4038<p></p>
4039
4040<script>
4041var filterResolve = function() {
4042 var defer = $.Deferred(),
4043 filtered = defer.then(function( value ) {
4044 return value * 2;
4045 });
4046
4047 defer.resolve( 5 );
4048 filtered.done(function( value ) {
4049 $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
4050 });
4051};
4052
4053$( "button" ).on( "click", filterResolve );
4054</script>
4055
4056</body>
4057</html>
4058```
4059 * @example ​ ````Chain tasks:
4060```javascript
4061var request = $.ajax( url, { dataType: "json" } ),
4062 chained = request.then(function( data ) {
4063 return $.ajax( url2, { data: { user: data.userId } } );
4064 });
4065
4066chained.done(function( data ) {
4067 // data retrieved from url2 as provided by the first request
4068});
4069```
4070 */
4071 then<
4072 ARD = never,
4073 AJD = never,
4074 AND = never,
4075 BRD = never,
4076 BJD = never,
4077 BND = never,
4078 CRD = never,
4079 CJD = never,
4080 CND = never,
4081 RRD = never,
4082 RJD = never,
4083 RND = never,
4084 >(
4085 doneFilter: (
4086 ...t: TR[]
4087 ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
4088 failFilter?: null,
4089 progressFilter?: null,
4090 ): PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND>;
4091
4092 // #endregion
4093
4094 /**
4095 * Add handlers to be called when the Deferred object is rejected.
4096 * @param failFilter A function that is called when the Deferred is rejected.
4097 * @see \`{@link https://api.jquery.com/deferred.catch/ }\`
4098 * @since 3.0
4099 * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can rejection handlers using the .catch method.
4100```javascript
4101$.get( "test.php" )
4102 .then( function() {
4103 alert( "$.get succeeded" );
4104 } )
4105 .catch( function() {
4106 alert( "$.get failed!" );
4107 } );
4108```
4109 */
4110 catch<
4111 ARF = never,
4112 AJF = never,
4113 ANF = never,
4114 BRF = never,
4115 BJF = never,
4116 BNF = never,
4117 CRF = never,
4118 CJF = never,
4119 CNF = never,
4120 RRF = never,
4121 RJF = never,
4122 RNF = never,
4123 >(
4124 failFilter?:
4125 | ((
4126 ...t: TJ[]
4127 ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF)
4128 | null,
4129 ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
4130 }
4131
4132 namespace Deferred {
4133 type CallbackBase<T, U, V, R> = (t: T, u: U, v: V, ...r: R[]) => void;
4134
4135 interface Callback3<T, U, V> extends CallbackBase<T, U, V, never> {}
4136
4137 type Callback<T> = (...args: T[]) => void;
4138
4139 /**
4140 * @deprecated ​ Deprecated. Use \`{@link Callback }\`.
4141 */
4142 interface DoneCallback<TResolve> extends Callback<TResolve> {}
4143
4144 /**
4145 * @deprecated ​ Deprecated. Use \`{@link Callback }\`.
4146 */
4147 interface FailCallback<TReject> extends Callback<TReject> {}
4148
4149 /**
4150 * @deprecated ​ Deprecated. Use \`{@link Callback }\`.
4151 */
4152 interface AlwaysCallback<TResolve, TReject> extends Callback<TResolve | TReject> {}
4153
4154 /**
4155 * @deprecated ​ Deprecated. Use \`{@link Callback }\`.
4156 */
4157 interface ProgressCallback<TNotify> extends Callback<TNotify> {}
4158 }
4159
4160 // #endregion
4161
4162 // region Effects
4163 // #region Effects
4164
4165 type Duration = number | "fast" | "slow";
4166
4167 /**
4168 * @see \`{@link https://api.jquery.com/animate/#animate-properties-options }\`
4169 */
4170 interface EffectsOptions<TElement> extends PlainObject {
4171 /**
4172 * A function to be called when the animation on an element completes or stops without completing (its Promise object is either resolved or rejected).
4173 */
4174 always?(this: TElement, animation: Animation<TElement>, jumpedToEnd: boolean): void;
4175 /**
4176 * A function that is called once the animation on an element is complete.
4177 */
4178 complete?(this: TElement): void;
4179 /**
4180 * A function to be called when the animation on an element completes (its Promise object is resolved).
4181 */
4182 done?(this: TElement, animation: Animation<TElement>, jumpedToEnd: boolean): void;
4183 /**
4184 * A string or number determining how long the animation will run.
4185 */
4186 duration?: Duration | undefined;
4187 /**
4188 * A string indicating which easing function to use for the transition.
4189 */
4190 easing?: string | undefined;
4191 /**
4192 * A function to be called when the animation on an element fails to complete (its Promise object is rejected).
4193 */
4194 fail?(this: TElement, animation: Animation<TElement>, jumpedToEnd: boolean): void;
4195 /**
4196 * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties.
4197 */
4198 progress?(this: TElement, animation: Animation<TElement>, progress: number, remainingMs: number): void;
4199 /**
4200 * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it.
4201 */
4202 queue?: boolean | string | undefined;
4203 /**
4204 * An object containing one or more of the CSS properties defined by the properties argument and their corresponding easing functions.
4205 */
4206 specialEasing?: PlainObject<string> | undefined;
4207 /**
4208 * A function to call when the animation on an element begins.
4209 */
4210 start?(this: TElement, animation: Animation<TElement>): void;
4211 /**
4212 * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set.
4213 */
4214 step?(this: TElement, now: number, tween: Tween<TElement>): void;
4215 }
4216
4217 // region Animation
4218 // #region Animation
4219
4220 /**
4221 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4222 * @since 1.8
4223 */
4224 interface AnimationStatic {
4225 /**
4226 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4227 * @since 1.8
4228 */
4229 <TElement>(element: TElement, props: PlainObject, opts: EffectsOptions<TElement>): Animation<TElement>;
4230 /**
4231 * During the initial setup, `jQuery.Animation` will call any callbacks that have been registered through `jQuery.Animation.prefilter( function( element, props, opts ) )`.
4232 * @param callback The prefilter will have `this` set to an animation object, and you can modify any of the `props` or
4233 * `opts` however you need. The prefilter _may_ return its own promise which also implements `stop()`,
4234 * in which case, processing of prefilters stops. If the prefilter is not trying to override the animation
4235 * entirely, it should return `undefined` or some other falsy value.
4236 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#prefilters }\`
4237 * @since 1.8
4238 */
4239 prefilter<TElement>(
4240 callback: (
4241 this: Animation<TElement>,
4242 element: TElement,
4243 props: PlainObject,
4244 opts: EffectsOptions<TElement>,
4245 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
4246 ) => Animation<TElement> | _Falsy | void,
4247 prepend?: boolean,
4248 ): void;
4249 /**
4250 * A "Tweener" is a function responsible for creating a tween object, and you might want to override these if you want to implement complex values ( like a clip/transform array matrix ) in a single property.
4251 *
4252 * You can override the default process for creating a tween in order to provide your own tween object by using `jQuery.Animation.tweener( props, callback( prop, value ) )`.
4253 * @param props A space separated list of properties to be passed to your tweener, or `"*"` if it should be called
4254 * for all properties.
4255 * @param callback The callback will be called with `this` being an `Animation` object. The tweener function will
4256 * generally start with `var tween = this.createTween( prop, value );`, but doesn't nessecarily need to
4257 * use the `jQuery.Tween()` factory.
4258 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweeners }\`
4259 * @since 1.8
4260 */
4261 tweener(props: string, callback: Tweener<any>): void;
4262 }
4263
4264 /**
4265 * The promise will be resolved when the animation reaches its end, and rejected when terminated early. The context of callbacks attached to the promise will be the element, and the arguments will be the `Animation` object and a boolean `jumpedToEnd` which when true means the animation was stopped with `gotoEnd`, when `undefined` the animation completed naturally.
4266 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4267 * @since 1.8
4268 */
4269 interface Animation<TElement> extends
4270 Promise3<
4271 Animation<TElement>,
4272 Animation<TElement>,
4273 Animation<TElement>,
4274 true | undefined,
4275 false,
4276 number,
4277 never,
4278 never,
4279 number
4280 >
4281 {
4282 /**
4283 * The duration specified in ms
4284 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4285 * @since 1.8
4286 */
4287 duration: number;
4288 /**
4289 * The element being animatied
4290 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4291 * @since 1.8
4292 */
4293 elem: TElement;
4294 /**
4295 * The final value of each property animating
4296 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4297 * @since 1.8
4298 */
4299 props: PlainObject;
4300 /**
4301 * The animation options
4302 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4303 * @since 1.8
4304 */
4305 opts: EffectsOptions<TElement>;
4306 /**
4307 * The original properties before being filtered
4308 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4309 * @since 1.8
4310 */
4311 originalProps: PlainObject;
4312 /**
4313 * The original options before being filtered
4314 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4315 * @since 1.8
4316 */
4317 originalOpts: EffectsOptions<TElement>;
4318 /**
4319 * The numeric value of `new Date()` when the animation began
4320 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4321 * @since 1.8
4322 */
4323 startTime: number;
4324 /**
4325 * The animations tweens.
4326 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4327 * @since 1.8
4328 */
4329 tweens: Array<Tween<TElement>>;
4330 /**
4331 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4332 * @since 1.8
4333 */
4334 createTween(propName: string, finalValue: number): Tween<TElement>;
4335 /**
4336 * Stops the animation early, optionally going to the end.
4337 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
4338 * @since 1.8
4339 */
4340 stop(gotoEnd: boolean): this;
4341 }
4342
4343 /**
4344 * A "Tweener" is a function responsible for creating a tween object, and you might want to override these if you want to implement complex values ( like a clip/transform array matrix ) in a single property.
4345 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweeners }\`
4346 * @since 1.8
4347 */
4348 type Tweener<TElement> = (this: Animation<TElement>, propName: string, finalValue: number) => Tween<TElement>;
4349
4350 /**
4351 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4352 * @since 1.8
4353 */
4354 interface TweenStatic {
4355 /**
4356 * `jQuery.Tween.propHooks[ prop ]` is a hook point that replaces `jQuery.fx.step[ prop ]` (which is being deprecated.) These hooks are used by the tween to get and set values on elements.
4357 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\`
4358 * @since 1.8
4359 * @example
4360```javascript
4361jQuery.Tween.propHooks[ property ] = {
4362 get: function( tween ) {
4363 // get tween.prop from tween.elem and return it
4364 },
4365 set: function( tween ) {
4366 // set tween.prop on tween.elem to tween.now + tween.unit
4367 }
4368}
4369```
4370 */
4371 propHooks: PropHooks;
4372 /**
4373 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4374 * @since 1.8
4375 */
4376 <TElement>(
4377 elem: TElement,
4378 options: EffectsOptions<TElement>,
4379 prop: string,
4380 end: number,
4381 easing?: string,
4382 unit?: string,
4383 ): Tween<TElement>;
4384 }
4385
4386 /**
4387 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4388 * @since 1.8
4389 */
4390 // This should be a class but doesn't work correctly under the JQuery namespace. Tween should be an inner class of jQuery.
4391 interface Tween<TElement> {
4392 /**
4393 * The easing used
4394 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4395 * @since 1.8
4396 */
4397 easing: string;
4398 /**
4399 * The element being animated
4400 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4401 * @since 1.8
4402 */
4403 elem: TElement;
4404 /**
4405 * The ending value of the tween
4406 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4407 * @since 1.8
4408 */
4409 end: number;
4410 /**
4411 * The current value of the tween
4412 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4413 * @since 1.8
4414 */
4415 now: number;
4416 /**
4417 * A reference to the animation options
4418 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4419 * @since 1.8
4420 */
4421 options: EffectsOptions<TElement>;
4422 // Undocumented. Is this intended to be public?
4423 pos?: number | undefined;
4424 /**
4425 * The property being animated
4426 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4427 * @since 1.8
4428 */
4429 prop: string;
4430 /**
4431 * The starting value of the tween
4432 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4433 * @since 1.8
4434 */
4435 start: number;
4436 /**
4437 * The CSS unit for the tween
4438 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4439 * @since 1.8
4440 */
4441 unit: string;
4442 /**
4443 * Reads the current value for property from the element
4444 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4445 * @since 1.8
4446 */
4447 cur(): any;
4448 /**
4449 * Updates the value for the property on the animated elemd.
4450 * @param progress A number from 0 to 1.
4451 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
4452 * @since 1.8
4453 */
4454 run(progress: number): this;
4455 }
4456
4457 /**
4458 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\`
4459 * @since 1.8
4460 */
4461 // Workaround for TypeScript 2.3 which does not have support for weak types handling.
4462 type PropHook<TElement> = {
4463 /**
4464 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\`
4465 * @since 1.8
4466 */
4467 get(tween: Tween<TElement>): any;
4468 } | {
4469 /**
4470 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\`
4471 * @since 1.8
4472 */
4473 set(tween: Tween<TElement>): void;
4474 } | {
4475 [key: string]: never;
4476 };
4477
4478 /**
4479 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\`
4480 * @since 1.8
4481 */
4482 interface PropHooks {
4483 [property: string]: PropHook<Node>;
4484 }
4485
4486 // #endregion
4487
4488 // region Easing
4489 // #region Easing
4490
4491 type EasingMethod = (percent: number) => number;
4492
4493 interface Easings {
4494 [name: string]: EasingMethod;
4495 }
4496
4497 // #endregion
4498
4499 // region Effects (fx)
4500 // #region Effects (fx)
4501
4502 interface Effects {
4503 /**
4504 * The rate (in milliseconds) at which animations fire.
4505 * @see \`{@link https://api.jquery.com/jQuery.fx.interval/ }\`
4506 * @since 1.4.3
4507 * @deprecated ​ Deprecated since 3.0. See \`{@link https://api.jquery.com/jQuery.fx.interval/ }\`.
4508 *
4509 * **Cause**: As of jQuery 3.0 the `jQuery.fx.interval` property can be used to change the animation interval only on browsers that do not support the `window.requestAnimationFrame()` method. That is currently only Internet Explorer 9 and the Android Browser. Once support is dropped for these browsers, the property will serve no purpose and it will be removed.
4510 *
4511 * **Solution**: Find and remove code that changes or uses `jQuery.fx.interval`. If the value is being used by code in your page or a plugin, the code may be making assumptions that are no longer valid. The default value of `jQuery.fx.interval` is `13` (milliseconds), which could be used instead of accessing this property.
4512 * @example ​ ````Cause all animations to run with less frames.
4513```html
4514<!doctype html>
4515<html lang="en">
4516<head>
4517 <meta charset="utf-8">
4518 <title>jQuery.fx.interval demo</title>
4519 <style>
4520 div {
4521 width: 50px;
4522 height: 30px;
4523 margin: 5px;
4524 float: left;
4525 background: green;
4526 }
4527 </style>
4528 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4529</head>
4530<body>
4531
4532<p><input type="button" value="Run"></p>
4533<div></div>
4534
4535<script>
4536jQuery.fx.interval = 100;
4537$( "input" ).click(function() {
4538 $( "div" ).toggle( 3000 );
4539});
4540</script>
4541</body>
4542</html>
4543```
4544 */
4545 interval: number;
4546 /**
4547 * Globally disable all animations.
4548 * @see \`{@link https://api.jquery.com/jQuery.fx.off/ }\`
4549 * @since 1.3
4550 * @example ​ ````Toggle animation on and off
4551```html
4552<!doctype html>
4553<html lang="en">
4554<head>
4555 <meta charset="utf-8">
4556 <title>jQuery.fx.off demo</title>
4557 <style>
4558 div {
4559 width: 50px;
4560 height: 30px;
4561 margin: 5px;
4562 float: left;
4563 background: green;
4564 }
4565 </style>
4566 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4567</head>
4568<body>
4569
4570<input type="button" value="Run">
4571<button>Toggle fx</button>
4572<div></div>
4573
4574<script>
4575var toggleFx = function() {
4576 $.fx.off = !$.fx.off;
4577};
4578toggleFx();
4579$( "button" ).click( toggleFx );
4580$( "input" ).click(function() {
4581 $( "div" ).toggle( "slow" );
4582});
4583</script>
4584</body>
4585</html>
4586```
4587 */
4588 off: boolean;
4589 /**
4590 * @deprecated ​ Deprecated since 1.8. Use \`{@link Tween.propHooks jQuery.Tween.propHooks}\`.
4591 *
4592 * `jQuery.fx.step` functions are being replaced by `jQuery.Tween.propHooks` and may eventually be removed, but are still supported via the default tween propHook.
4593 */
4594 step: PlainObject<AnimationHook<Node>>;
4595 /**
4596 * _overridable_ Clears up the `setInterval`
4597 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#plugging-in-a-different-timer-loop }\`
4598 * @since 1.8
4599 */
4600 stop(): void;
4601 /**
4602 * Calls `.run()` on each object in the `jQuery.timers` array, removing it from the array if `.run()` returns a falsy value. Calls `jQuery.fx.stop()` whenever there are no timers remaining.
4603 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#plugging-in-a-different-timer-loop }\`
4604 * @since 1.8
4605 */
4606 tick(): void;
4607 /**
4608 * _overridable_ Creates a `setInterval` if one doesn't already exist, and pushes `tickFunction` to the `jQuery.timers` array. `tickFunction` should also have `anim`, `elem`, and `queue` properties that reference the animation object, animated element, and queue option to facilitate `jQuery.fn.stop()`
4609 *
4610 * By overriding `fx.timer` and `fx.stop` you should be able to implement any animation tick behaviour you desire. (like using `requestAnimationFrame` instead of `setTimeout`.)
4611 *
4612 * There is an example of overriding the timer loop in \`{@link https://github.com/gnarf37/jquery-requestAnimationFrame jquery.requestAnimationFrame}\`
4613 * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#plugging-in-a-different-timer-loop }\`
4614 * @since 1.8
4615 */
4616 timer(tickFunction: TickFunction<any>): void;
4617 }
4618
4619 /**
4620 * @deprecated ​ Deprecated since 1.8. Use \`{@link Tween.propHooks jQuery.Tween.propHooks}\`.
4621 *
4622 * `jQuery.fx.step` functions are being replaced by `jQuery.Tween.propHooks` and may eventually be removed, but are still supported via the default tween propHook.
4623 */
4624 type AnimationHook<TElement> = (fx: Tween<TElement>) => void;
4625
4626 interface TickFunction<TElement> {
4627 anim: Animation<TElement>;
4628 elem: TElement;
4629 queue: boolean | string;
4630 (): any;
4631 }
4632
4633 // #endregion
4634
4635 // region Queue
4636 // #region Queue
4637
4638 // TODO: Is the first element always a string or is that specific to the 'fx' queue?
4639 type Queue<TElement> = { 0: string } & Array<QueueFunction<TElement>>;
4640
4641 type QueueFunction<TElement> = (this: TElement, next: () => void) => void;
4642
4643 // #endregion
4644
4645 // region Speed
4646 // #region Speed
4647
4648 // Workaround for TypeScript 2.3 which does not have support for weak types handling.
4649 type SpeedSettings<TElement> = {
4650 /**
4651 * A string or number determining how long the animation will run.
4652 */
4653 duration: Duration;
4654 } | {
4655 /**
4656 * A string indicating which easing function to use for the transition.
4657 */
4658 easing: string;
4659 } | {
4660 /**
4661 * A function to call once the animation is complete.
4662 */
4663 complete(this: TElement): void;
4664 } | {
4665 [key: string]: never;
4666 };
4667
4668 // #endregion
4669
4670 // #endregion
4671
4672 // region Events
4673 // #region Events
4674
4675 // region Event
4676 // #region Event
4677
4678 // This should be a class but doesn't work correctly under the JQuery namespace. Event should be an inner class of jQuery.
4679
4680 /**
4681 * jQuery's event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler (no checks for window.event required). It normalizes the target, relatedTarget, which, metaKey and pageX/Y properties and provides both stopPropagation() and preventDefault() methods.
4682 *
4683 * Those properties are all documented, and accompanied by examples, on the \`{@link http://api.jquery.com/category/events/event-object/ Event object}\` page.
4684 *
4685 * The standard events in the Document Object Model are: `blur`, `focus`, `load`, `resize`, `scroll`, `unload`, `beforeunload`, `click`, `dblclick`, `mousedown`, `mouseup`, `mousemove`, `mouseover`, `mouseout`, `mouseenter`, `mouseleave`, `change`, `select`, `submit`, `keydown`, `keypress`, and `keyup`. Since the DOM event names have predefined meanings for some elements, using them for other purposes is not recommended. jQuery's event model can trigger an event by any name on an element, and it is propagated up the DOM tree to which that element belongs, if any.
4686 * @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
4687 */
4688 interface EventStatic {
4689 /**
4690 * The jQuery.Event constructor is exposed and can be used when calling trigger. The new operator is optional.
4691 *
4692 * Check \`{@link https://api.jquery.com/trigger/ trigger}\`'s documentation to see how to combine it with your own event object.
4693 * @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
4694 * @since 1.6
4695 * @example
4696```javascript
4697//Create a new jQuery.Event object without the "new" operator.
4698var e = jQuery.Event( "click" );
4699
4700// trigger an artificial click event
4701jQuery( "body" ).trigger( e );
4702```
4703 * @example
4704```javascript
4705// Create a new jQuery.Event object with specified event properties.
4706var e = jQuery.Event( "keydown", { keyCode: 64 } );
4707
4708// trigger an artificial keydown event with keyCode 64
4709jQuery( "body" ).trigger( e );
4710```
4711 */
4712 <T extends object>(event: string, properties?: T): Event & T;
4713 /**
4714 * The jQuery.Event constructor is exposed and can be used when calling trigger. The new operator is optional.
4715 *
4716 * Check \`{@link https://api.jquery.com/trigger/ trigger}\`'s documentation to see how to combine it with your own event object.
4717 * @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
4718 * @since 1.6
4719 * @example
4720```javascript
4721//Create a new jQuery.Event object without the "new" operator.
4722var e = jQuery.Event( "click" );
4723
4724// trigger an artificial click event
4725jQuery( "body" ).trigger( e );
4726```
4727 * @example
4728```javascript
4729// Create a new jQuery.Event object with specified event properties.
4730var e = jQuery.Event( "keydown", { keyCode: 64 } );
4731
4732// trigger an artificial keydown event with keyCode 64
4733jQuery( "body" ).trigger( e );
4734```
4735 */
4736 new<T extends object>(event: string, properties?: T): Event & T;
4737 }
4738
4739 /**
4740 * jQuery's event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler (no checks for window.event required). It normalizes the target, relatedTarget, which, metaKey and pageX/Y properties and provides both stopPropagation() and preventDefault() methods.
4741 *
4742 * Those properties are all documented, and accompanied by examples, on the \`{@link http://api.jquery.com/category/events/event-object/ Event object}\` page.
4743 *
4744 * The standard events in the Document Object Model are: `blur`, `focus`, `load`, `resize`, `scroll`, `unload`, `beforeunload`, `click`, `dblclick`, `mousedown`, `mouseup`, `mousemove`, `mouseover`, `mouseout`, `mouseenter`, `mouseleave`, `change`, `select`, `submit`, `keydown`, `keypress`, and `keyup`. Since the DOM event names have predefined meanings for some elements, using them for other purposes is not recommended. jQuery's event model can trigger an event by any name on an element, and it is propagated up the DOM tree to which that element belongs, if any.
4745 * @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
4746 * @see \`{@link TriggeredEvent }\`
4747 */
4748 interface Event {
4749 // region Copied properties
4750 // #region Copied properties
4751
4752 // Event
4753
4754 bubbles: boolean | undefined;
4755 cancelable: boolean | undefined;
4756 eventPhase: number | undefined;
4757
4758 // UIEvent
4759
4760 detail: number | undefined;
4761 view: Window | undefined;
4762
4763 // MouseEvent
4764
4765 button: number | undefined;
4766 buttons: number | undefined;
4767 clientX: number | undefined;
4768 clientY: number | undefined;
4769 offsetX: number | undefined;
4770 offsetY: number | undefined;
4771 /**
4772 * The mouse position relative to the left edge of the document.
4773 * @see \`{@link https://api.jquery.com/event.pageX/ }\`
4774 * @since 1.0.4
4775 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
4776```html
4777<!doctype html>
4778<html lang="en">
4779<head>
4780 <meta charset="utf-8">
4781 <title>event.pageX demo</title>
4782 <style>
4783 body {
4784 background-color: #eef;
4785 }
4786 div {
4787 padding: 20px;
4788 }
4789 </style>
4790 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4791</head>
4792<body>
4793
4794<div id="log"></div>
4795
4796<script>
4797$( document ).on( "mousemove", function( event ) {
4798 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
4799});
4800</script>
4801
4802</body>
4803</html>
4804```
4805 */
4806 pageX: number | undefined;
4807 /**
4808 * The mouse position relative to the top edge of the document.
4809 * @see \`{@link https://api.jquery.com/event.pageY/ }\`
4810 * @since 1.0.4
4811 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
4812```html
4813<!doctype html>
4814<html lang="en">
4815<head>
4816 <meta charset="utf-8">
4817 <title>event.pageY demo</title>
4818 <style>
4819 body {
4820 background-color: #eef;
4821 }
4822 div {
4823 padding: 20px;
4824 }
4825 </style>
4826 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4827</head>
4828<body>
4829
4830<div id="log"></div>
4831
4832<script>
4833$( document ).on( "mousemove", function( event ) {
4834 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
4835});
4836</script>
4837
4838</body>
4839</html>
4840```
4841 */
4842 pageY: number | undefined;
4843 screenX: number | undefined;
4844 screenY: number | undefined;
4845 /** @deprecated */
4846 toElement: Element | undefined;
4847
4848 // PointerEvent
4849
4850 pointerId: number | undefined;
4851 pointerType: string | undefined;
4852
4853 // KeyboardEvent
4854
4855 /** @deprecated */
4856 char: string | undefined;
4857 /** @deprecated */
4858 charCode: number | undefined;
4859 key: string | undefined;
4860 /** @deprecated */
4861 keyCode: number | undefined;
4862
4863 // TouchEvent
4864
4865 changedTouches: TouchList | undefined;
4866 targetTouches: TouchList | undefined;
4867 touches: TouchList | undefined;
4868
4869 // MouseEvent, KeyboardEvent
4870
4871 /**
4872 * For key or mouse events, this property indicates the specific key or button that was pressed.
4873 * @see \`{@link https://api.jquery.com/event.which/ }\`
4874 * @since 1.1.3
4875 * @example ​ ````Log which key was depressed.
4876```html
4877<!doctype html>
4878<html lang="en">
4879<head>
4880 <meta charset="utf-8">
4881 <title>event.which demo</title>
4882 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4883</head>
4884<body>
4885
4886<input id="whichkey" value="type something">
4887<div id="log"></div>
4888
4889<script>
4890$( "#whichkey" ).on( "keydown", function( event ) {
4891 $( "#log" ).html( event.type + ": " + event.which );
4892});
4893</script>
4894
4895</body>
4896</html>
4897```
4898 * @example ​ ````Log which mouse button was depressed.
4899```html
4900<!doctype html>
4901<html lang="en">
4902<head>
4903 <meta charset="utf-8">
4904 <title>event.which demo</title>
4905 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4906</head>
4907<body>
4908
4909<input id="whichkey" value="click here">
4910<div id="log"></div>
4911
4912<script>
4913$( "#whichkey" ).on( "mousedown", function( event ) {
4914 $( "#log" ).html( event.type + ": " + event.which );
4915});
4916</script>
4917
4918</body>
4919</html>
4920```
4921 */
4922 which: number | undefined;
4923
4924 // MouseEvent, KeyboardEvent, TouchEvent
4925
4926 altKey: boolean | undefined;
4927 ctrlKey: boolean | undefined;
4928 /**
4929 * Indicates whether the META key was pressed when the event fired.
4930 * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
4931 * @since 1.0.4
4932 * @example ​ ````Determine whether the META key was pressed when the event fired.
4933```html
4934<!doctype html>
4935<html lang="en">
4936<head>
4937 <meta charset="utf-8">
4938 <title>event.metaKey demo</title>
4939 <style>
4940 body {
4941 background-color: #eef;
4942 }
4943 div {
4944 padding: 20px;
4945 }
4946 </style>
4947 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4948</head>
4949<body>
4950
4951<button value="Test" name="Test" id="checkMetaKey">Click me!</button>
4952<div id="display"></div>
4953
4954<script>
4955$( "#checkMetaKey" ).click(function( event ) {
4956 $( "#display" ).text( event.metaKey );
4957});
4958</script>
4959
4960</body>
4961</html>
4962```
4963 */
4964 metaKey: boolean | undefined;
4965 shiftKey: boolean | undefined;
4966
4967 // #endregion
4968
4969 /**
4970 * The difference in milliseconds between the time the browser created the event and January 1, 1970.
4971 * @see \`{@link https://api.jquery.com/event.timeStamp/ }\`
4972 * @since 1.2.6
4973 * @example ​ ````Display the time since the click handler last executed.
4974```html
4975<!doctype html>
4976<html lang="en">
4977<head>
4978 <meta charset="utf-8">
4979 <title>event.timeStamp demo</title>
4980 <style>
4981 div {
4982 height: 100px;
4983 width: 300px;
4984 margin: 10px;
4985 background-color: #ffd;
4986 overflow: auto;
4987 }
4988 </style>
4989 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
4990</head>
4991<body>
4992
4993<div>Click.</div>
4994
4995<script>
4996var last, diff;
4997$( "div" ).click(function( event ) {
4998 if ( last ) {
4999 diff = event.timeStamp - last;
5000 $( "div" ).append( "time since last event: " + diff + "<br>" );
5001 } else {
5002 $( "div" ).append( "Click again.<br>" );
5003 }
5004 last = event.timeStamp;
5005});
5006</script>
5007
5008</body>
5009</html>
5010```
5011 */
5012 timeStamp: number;
5013 /**
5014 * Describes the nature of the event.
5015 * @see \`{@link https://api.jquery.com/event.type/ }\`
5016 * @since 1.0
5017 * @example ​ ````On all anchor clicks, alert the event type.
5018```javascript
5019$( "a" ).click(function( event ) {
5020 alert( event.type ); // "click"
5021});
5022```
5023 */
5024 type: string;
5025 /**
5026 * Returns whether event.preventDefault() was ever called on this event object.
5027 * @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\`
5028 * @since 1.3
5029 * @example ​ ````Checks whether event.preventDefault() was called.
5030```javascript
5031$( "a" ).click(function( event ) {
5032 alert( event.isDefaultPrevented() ); // false
5033 event.preventDefault();
5034 alert( event.isDefaultPrevented() ); // true
5035});
5036```
5037 */
5038 isDefaultPrevented(): boolean;
5039 /**
5040 * Returns whether event.stopImmediatePropagation() was ever called on this event object.
5041 * @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\`
5042 * @since 1.3
5043 * @example ​ ````Checks whether event.stopImmediatePropagation() was called.
5044```html
5045<!doctype html>
5046<html lang="en">
5047<head>
5048 <meta charset="utf-8">
5049 <title>event.isImmediatePropagationStopped demo</title>
5050 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5051</head>
5052<body>
5053
5054<button>click me</button>
5055<div id="stop-log"></div>
5056
5057<script>
5058function immediatePropStopped( event ) {
5059 var msg = "";
5060 if ( event.isImmediatePropagationStopped() ) {
5061 msg = "called";
5062 } else {
5063 msg = "not called";
5064 }
5065 $( "#stop-log" ).append( "<div>" + msg + "</div>" );
5066}
5067
5068$( "button" ).click(function( event ) {
5069 immediatePropStopped( event );
5070 event.stopImmediatePropagation();
5071 immediatePropStopped( event );
5072});
5073</script>
5074
5075</body>
5076</html>
5077```
5078 */
5079 isImmediatePropagationStopped(): boolean;
5080 /**
5081 * Returns whether event.stopPropagation() was ever called on this event object.
5082 * @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\`
5083 * @since 1.3
5084 * @example ​ ````Checks whether event.stopPropagation() was called
5085```html
5086<!doctype html>
5087<html lang="en">
5088<head>
5089 <meta charset="utf-8">
5090 <title>event.isPropagationStopped demo</title>
5091 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5092</head>
5093<body>
5094
5095<button>click me</button>
5096<div id="stop-log"></div>
5097
5098<script>
5099function propStopped( event ) {
5100 var msg = "";
5101 if ( event.isPropagationStopped() ) {
5102 msg = "called";
5103 } else {
5104 msg = "not called";
5105 }
5106 $( "#stop-log" ).append( "<div>" + msg + "</div>" );
5107}
5108
5109$( "button" ).click(function(event) {
5110 propStopped( event );
5111 event.stopPropagation();
5112 propStopped( event );
5113});
5114</script>
5115
5116</body>
5117</html>
5118```
5119 */
5120 isPropagationStopped(): boolean;
5121 /**
5122 * If this method is called, the default action of the event will not be triggered.
5123 * @see \`{@link https://api.jquery.com/event.preventDefault/ }\`
5124 * @since 1.0
5125 * @example ​ ````Cancel the default action (navigation) of the click.
5126```html
5127<!doctype html>
5128<html lang="en">
5129<head>
5130 <meta charset="utf-8">
5131 <title>event.preventDefault demo</title>
5132 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5133</head>
5134<body>
5135
5136<a href="https://jquery.com">default click action is prevented</a>
5137<div id="log"></div>
5138
5139<script>
5140$( "a" ).click(function( event ) {
5141 event.preventDefault();
5142 $( "<div>" )
5143 .append( "default " + event.type + " prevented" )
5144 .appendTo( "#log" );
5145});
5146</script>
5147
5148</body>
5149</html>
5150```
5151 */
5152 preventDefault(): void;
5153 /**
5154 * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.
5155 * @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\`
5156 * @since 1.3
5157 * @example ​ ````Prevents other event handlers from being called.
5158```html
5159<!doctype html>
5160<html lang="en">
5161<head>
5162 <meta charset="utf-8">
5163 <title>event.stopImmediatePropagation demo</title>
5164 <style>
5165 p {
5166 height: 30px;
5167 width: 150px;
5168 background-color: #ccf;
5169 }
5170 div {
5171 height: 30px;
5172 width: 150px;
5173 background-color: #cfc;
5174 }
5175 </style>
5176 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5177</head>
5178<body>
5179
5180<p>paragraph</p>
5181<div>division</div>
5182
5183<script>
5184$( "p" ).click(function( event ) {
5185 event.stopImmediatePropagation();
5186});
5187$( "p" ).click(function( event ) {
5188 // This function won't be executed
5189 $( this ).css( "background-color", "#f00" );
5190});
5191$( "div" ).click(function( event ) {
5192 // This function will be executed
5193 $( this ).css( "background-color", "#f00" );
5194});
5195</script>
5196
5197</body>
5198</html>
5199```
5200 */
5201 stopImmediatePropagation(): void;
5202 /**
5203 * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
5204 * @see \`{@link https://api.jquery.com/event.stopPropagation/ }\`
5205 * @since 1.0
5206 * @example ​ ````Kill the bubbling on the click event.
5207```javascript
5208$( "p" ).click(function( event ) {
5209 event.stopPropagation();
5210 // Do something
5211});
5212```
5213 */
5214 stopPropagation(): void;
5215 }
5216
5217 // #endregion
5218
5219 /**
5220 * Base type for jQuery events that have been triggered (including events triggered on plain objects).
5221 */
5222 interface TriggeredEvent<
5223 TDelegateTarget = any,
5224 TData = any,
5225 TCurrentTarget = any,
5226 TTarget = any,
5227 > extends Event {
5228 /**
5229 * The current DOM element within the event bubbling phase.
5230 * @see \`{@link https://api.jquery.com/event.currentTarget/ }\`
5231 * @since 1.3
5232 * @example ​ ````Alert that currentTarget matches the `this` keyword.
5233```javascript
5234$( "p" ).click(function( event ) {
5235 alert( event.currentTarget === this ); // true
5236});
5237```
5238 */
5239 currentTarget: TCurrentTarget;
5240 /**
5241 * The element where the currently-called jQuery event handler was attached.
5242 * @see \`{@link https://api.jquery.com/event.delegateTarget/ }\`
5243 * @since 1.7
5244 * @example ​ ````When a button in any box class is clicked, change the box&#39;s background color to red.
5245```javascript
5246$( ".box" ).on( "click", "button", function( event ) {
5247 $( event.delegateTarget ).css( "background-color", "red" );
5248});
5249```
5250 */
5251 delegateTarget: TDelegateTarget;
5252 /**
5253 * The DOM element that initiated the event.
5254 * @see \`{@link https://api.jquery.com/event.target/ }\`
5255 * @since 1.0
5256 * @example ​ ````Display the tag&#39;s name on click
5257```html
5258<!doctype html>
5259<html lang="en">
5260<head>
5261 <meta charset="utf-8">
5262 <title>event.target demo</title>
5263 <style>
5264 span, strong, p {
5265 padding: 8px;
5266 display: block;
5267 border: 1px solid #999;
5268 }
5269 </style>
5270 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5271</head>
5272<body>
5273
5274<div id="log"></div>
5275<div>
5276 <p>
5277 <strong><span>click</span></strong>
5278 </p>
5279</div>
5280
5281<script>
5282$( "body" ).click(function( event ) {
5283 $( "#log" ).html( "clicked: " + event.target.nodeName );
5284});
5285</script>
5286
5287</body>
5288</html>
5289```
5290 * @example ​ ````Implements a simple event delegation: The click handler is added to an unordered list, and the children of its li children are hidden. Clicking one of the li children toggles (see toggle()) their children.
5291```html
5292<!doctype html>
5293<html lang="en">
5294<head>
5295 <meta charset="utf-8">
5296 <title>event.target demo</title>
5297 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5298</head>
5299<body>
5300
5301<ul>
5302 <li>item 1
5303 <ul>
5304 <li>sub item 1-a</li>
5305 <li>sub item 1-b</li>
5306 </ul>
5307 </li>
5308 <li>item 2
5309 <ul>
5310 <li>sub item 2-a</li>
5311 <li>sub item 2-b</li>
5312 </ul>
5313 </li>
5314</ul>
5315
5316<script>
5317function handler( event ) {
5318 var target = $( event.target );
5319 if ( target.is( "li" ) ) {
5320 target.children().toggle();
5321 }
5322}
5323$( "ul" ).click( handler ).find( "ul" ).hide();
5324</script>
5325
5326</body>
5327</html>
5328```
5329 */
5330 target: TTarget;
5331
5332 /**
5333 * An optional object of data passed to an event method when the current executing handler is bound.
5334 * @see \`{@link https://api.jquery.com/event.data/ }\`
5335 * @since 1.1
5336 * @example ​ ````Within a for loop, pass the value of i to the .on() method so that the current iteration&#39;s value is preserved.
5337```html
5338<!doctype html>
5339<html lang="en">
5340<head>
5341 <meta charset="utf-8">
5342 <title>event.data demo</title>
5343 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5344</head>
5345<body>
5346
5347<button> 0 </button>
5348<button> 1 </button>
5349<button> 2 </button>
5350<button> 3 </button>
5351<button> 4 </button>
5352
5353<div id="log"></div>
5354
5355<script>
5356var logDiv = $( "#log" );
5357
5358for ( var i = 0; i < 5; i++ ) {
5359 $( "button" ).eq( i ).on( "click", { value: i }, function( event ) {
5360 var msgs = [
5361 "button = " + $( this ).index(),
5362 "event.data.value = " + event.data.value,
5363 "i = " + i
5364 ];
5365 logDiv.append( msgs.join( ", " ) + "<br>" );
5366 });
5367}
5368</script>
5369
5370</body>
5371</html>
5372```
5373 */
5374 data: TData;
5375
5376 /**
5377 * The namespace specified when the event was triggered.
5378 * @see \`{@link https://api.jquery.com/event.namespace/ }\`
5379 * @since 1.4.3
5380 * @example ​ ````Determine the event namespace used.
5381```html
5382<!doctype html>
5383<html lang="en">
5384<head>
5385 <meta charset="utf-8">
5386 <title>event.namespace demo</title>
5387 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5388</head>
5389<body>
5390
5391<button>display event.namespace</button>
5392<p></p>
5393
5394<script>
5395$( "p" ).on( "test.something", function( event ) {
5396 alert( event.namespace );
5397});
5398$( "button" ).click(function( event ) {
5399 $( "p" ).trigger( "test.something" );
5400});
5401</script>
5402
5403</body>
5404</html>
5405```
5406 */
5407 namespace?: string | undefined;
5408 originalEvent?: _Event | undefined;
5409 /**
5410 * The last value returned by an event handler that was triggered by this event, unless the value was undefined.
5411 * @see \`{@link https://api.jquery.com/event.result/ }\`
5412 * @since 1.3
5413 * @example ​ ````Display previous handler&#39;s return value
5414```html
5415<!doctype html>
5416<html lang="en">
5417<head>
5418 <meta charset="utf-8">
5419 <title>event.result demo</title>
5420 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5421</head>
5422<body>
5423
5424<button>display event.result</button>
5425<p></p>
5426
5427<script>
5428$( "button" ).click(function( event ) {
5429 return "hey";
5430});
5431$( "button" ).click(function( event ) {
5432 $( "p" ).html( event.result );
5433});
5434</script>
5435
5436</body>
5437</html>
5438```
5439 */
5440 result?: any;
5441 }
5442
5443 // region Event
5444 // #region Event
5445
5446 interface EventBase<
5447 TDelegateTarget = any,
5448 TData = any,
5449 TCurrentTarget = any,
5450 TTarget = any,
5451 > extends TriggeredEvent<TDelegateTarget, TData, TCurrentTarget, TTarget> {
5452 /**
5453 * The other DOM element involved in the event, if any.
5454 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
5455 * @since 1.1.4
5456 * @example ​ ````On mouseout of anchors, alert the element type being entered.
5457```javascript
5458$( "a" ).mouseout(function( event ) {
5459 alert( event.relatedTarget.nodeName ); // "DIV"
5460});
5461```
5462 */
5463 relatedTarget?: undefined;
5464
5465 // Event
5466
5467 bubbles: boolean;
5468 cancelable: boolean;
5469 eventPhase: number;
5470
5471 // UIEvent
5472
5473 detail: undefined;
5474 view: undefined;
5475
5476 // MouseEvent
5477
5478 button: undefined;
5479 buttons: undefined;
5480 clientX: undefined;
5481 clientY: undefined;
5482 offsetX: undefined;
5483 offsetY: undefined;
5484 /**
5485 * The mouse position relative to the left edge of the document.
5486 * @see \`{@link https://api.jquery.com/event.pageX/ }\`
5487 * @since 1.0.4
5488 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
5489```html
5490<!doctype html>
5491<html lang="en">
5492<head>
5493 <meta charset="utf-8">
5494 <title>event.pageX demo</title>
5495 <style>
5496 body {
5497 background-color: #eef;
5498 }
5499 div {
5500 padding: 20px;
5501 }
5502 </style>
5503 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5504</head>
5505<body>
5506
5507<div id="log"></div>
5508
5509<script>
5510$( document ).on( "mousemove", function( event ) {
5511 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
5512});
5513</script>
5514
5515</body>
5516</html>
5517```
5518 */
5519 pageX: undefined;
5520 /**
5521 * The mouse position relative to the top edge of the document.
5522 * @see \`{@link https://api.jquery.com/event.pageY/ }\`
5523 * @since 1.0.4
5524 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
5525```html
5526<!doctype html>
5527<html lang="en">
5528<head>
5529 <meta charset="utf-8">
5530 <title>event.pageY demo</title>
5531 <style>
5532 body {
5533 background-color: #eef;
5534 }
5535 div {
5536 padding: 20px;
5537 }
5538 </style>
5539 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5540</head>
5541<body>
5542
5543<div id="log"></div>
5544
5545<script>
5546$( document ).on( "mousemove", function( event ) {
5547 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
5548});
5549</script>
5550
5551</body>
5552</html>
5553```
5554 */
5555 pageY: undefined;
5556 screenX: undefined;
5557 screenY: undefined;
5558 /** @deprecated */
5559 toElement: undefined;
5560
5561 // PointerEvent
5562
5563 pointerId: undefined;
5564 pointerType: undefined;
5565
5566 // KeyboardEvent
5567
5568 /** @deprecated */
5569 char: undefined;
5570 /** @deprecated */
5571 charCode: undefined;
5572 key: undefined;
5573 /** @deprecated */
5574 keyCode: undefined;
5575
5576 // TouchEvent
5577
5578 changedTouches: undefined;
5579 targetTouches: undefined;
5580 touches: undefined;
5581
5582 // MouseEvent, KeyboardEvent
5583
5584 /**
5585 * For key or mouse events, this property indicates the specific key or button that was pressed.
5586 * @see \`{@link https://api.jquery.com/event.which/ }\`
5587 * @since 1.1.3
5588 * @example ​ ````Log which key was depressed.
5589```html
5590<!doctype html>
5591<html lang="en">
5592<head>
5593 <meta charset="utf-8">
5594 <title>event.which demo</title>
5595 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5596</head>
5597<body>
5598
5599<input id="whichkey" value="type something">
5600<div id="log"></div>
5601
5602<script>
5603$( "#whichkey" ).on( "keydown", function( event ) {
5604 $( "#log" ).html( event.type + ": " + event.which );
5605});
5606</script>
5607
5608</body>
5609</html>
5610```
5611 * @example ​ ````Log which mouse button was depressed.
5612```html
5613<!doctype html>
5614<html lang="en">
5615<head>
5616 <meta charset="utf-8">
5617 <title>event.which demo</title>
5618 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5619</head>
5620<body>
5621
5622<input id="whichkey" value="click here">
5623<div id="log"></div>
5624
5625<script>
5626$( "#whichkey" ).on( "mousedown", function( event ) {
5627 $( "#log" ).html( event.type + ": " + event.which );
5628});
5629</script>
5630
5631</body>
5632</html>
5633```
5634 */
5635 which: undefined;
5636
5637 // MouseEvent, KeyboardEvent, TouchEvent
5638
5639 altKey: undefined;
5640 ctrlKey: undefined;
5641 /**
5642 * Indicates whether the META key was pressed when the event fired.
5643 * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
5644 * @since 1.0.4
5645 * @example ​ ````Determine whether the META key was pressed when the event fired.
5646```html
5647<!doctype html>
5648<html lang="en">
5649<head>
5650 <meta charset="utf-8">
5651 <title>event.metaKey demo</title>
5652 <style>
5653 body {
5654 background-color: #eef;
5655 }
5656 div {
5657 padding: 20px;
5658 }
5659 </style>
5660 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5661</head>
5662<body>
5663
5664<button value="Test" name="Test" id="checkMetaKey">Click me!</button>
5665<div id="display"></div>
5666
5667<script>
5668$( "#checkMetaKey" ).click(function( event ) {
5669 $( "#display" ).text( event.metaKey );
5670});
5671</script>
5672
5673</body>
5674</html>
5675```
5676 */
5677 metaKey: undefined;
5678 shiftKey: undefined;
5679
5680 originalEvent?: _Event | undefined;
5681 }
5682
5683 interface ChangeEvent<
5684 TDelegateTarget = any,
5685 TData = any,
5686 TCurrentTarget = any,
5687 TTarget = any,
5688 > extends EventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
5689 type: "change";
5690 }
5691
5692 interface ResizeEvent<
5693 TDelegateTarget = any,
5694 TData = any,
5695 TCurrentTarget = any,
5696 TTarget = any,
5697 > extends EventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
5698 type: "resize";
5699 }
5700
5701 interface ScrollEvent<
5702 TDelegateTarget = any,
5703 TData = any,
5704 TCurrentTarget = any,
5705 TTarget = any,
5706 > extends EventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
5707 type: "scroll";
5708 }
5709
5710 interface SelectEvent<
5711 TDelegateTarget = any,
5712 TData = any,
5713 TCurrentTarget = any,
5714 TTarget = any,
5715 > extends EventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
5716 type: "select";
5717 }
5718
5719 interface SubmitEvent<
5720 TDelegateTarget = any,
5721 TData = any,
5722 TCurrentTarget = any,
5723 TTarget = any,
5724 > extends EventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
5725 type: "submit";
5726 }
5727
5728 // #endregion
5729
5730 // region UIEvent
5731 // #region UIEvent
5732
5733 interface UIEventBase<
5734 TDelegateTarget = any,
5735 TData = any,
5736 TCurrentTarget = any,
5737 TTarget = any,
5738 > extends TriggeredEvent<TDelegateTarget, TData, TCurrentTarget, TTarget> {
5739 // Event
5740
5741 bubbles: boolean;
5742 cancelable: boolean;
5743 eventPhase: number;
5744
5745 // UIEvent
5746
5747 detail: number;
5748 view: Window;
5749
5750 originalEvent?: _UIEvent | undefined;
5751 }
5752
5753 // region MouseEvent
5754 // #region MouseEvent
5755
5756 interface MouseEventBase<
5757 TDelegateTarget = any,
5758 TData = any,
5759 TCurrentTarget = any,
5760 TTarget = any,
5761 > extends UIEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
5762 /**
5763 * The other DOM element involved in the event, if any.
5764 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
5765 * @since 1.1.4
5766 * @example ​ ````On mouseout of anchors, alert the element type being entered.
5767```javascript
5768$( "a" ).mouseout(function( event ) {
5769 alert( event.relatedTarget.nodeName ); // "DIV"
5770});
5771```
5772 */
5773 relatedTarget?: EventTarget | null | undefined;
5774
5775 // MouseEvent
5776
5777 button: number;
5778 buttons: number;
5779 clientX: number;
5780 clientY: number;
5781 offsetX: number;
5782 offsetY: number;
5783 /**
5784 * The mouse position relative to the left edge of the document.
5785 * @see \`{@link https://api.jquery.com/event.pageX/ }\`
5786 * @since 1.0.4
5787 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
5788```html
5789<!doctype html>
5790<html lang="en">
5791<head>
5792 <meta charset="utf-8">
5793 <title>event.pageX demo</title>
5794 <style>
5795 body {
5796 background-color: #eef;
5797 }
5798 div {
5799 padding: 20px;
5800 }
5801 </style>
5802 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5803</head>
5804<body>
5805
5806<div id="log"></div>
5807
5808<script>
5809$( document ).on( "mousemove", function( event ) {
5810 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
5811});
5812</script>
5813
5814</body>
5815</html>
5816```
5817 */
5818 pageX: number;
5819 /**
5820 * The mouse position relative to the top edge of the document.
5821 * @see \`{@link https://api.jquery.com/event.pageY/ }\`
5822 * @since 1.0.4
5823 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
5824```html
5825<!doctype html>
5826<html lang="en">
5827<head>
5828 <meta charset="utf-8">
5829 <title>event.pageY demo</title>
5830 <style>
5831 body {
5832 background-color: #eef;
5833 }
5834 div {
5835 padding: 20px;
5836 }
5837 </style>
5838 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5839</head>
5840<body>
5841
5842<div id="log"></div>
5843
5844<script>
5845$( document ).on( "mousemove", function( event ) {
5846 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
5847});
5848</script>
5849
5850</body>
5851</html>
5852```
5853 */
5854 pageY: number;
5855 screenX: number;
5856 screenY: number;
5857 /** @deprecated */
5858 toElement: Element;
5859
5860 // PointerEvent
5861
5862 pointerId: undefined;
5863 pointerType: undefined;
5864
5865 // KeyboardEvent
5866
5867 /** @deprecated */
5868 char: undefined;
5869 /** @deprecated */
5870 charCode: undefined;
5871 key: undefined;
5872 /** @deprecated */
5873 keyCode: undefined;
5874
5875 // TouchEvent
5876
5877 changedTouches: undefined;
5878 targetTouches: undefined;
5879 touches: undefined;
5880
5881 // MouseEvent, KeyboardEvent
5882
5883 /**
5884 * For key or mouse events, this property indicates the specific key or button that was pressed.
5885 * @see \`{@link https://api.jquery.com/event.which/ }\`
5886 * @since 1.1.3
5887 * @example ​ ````Log which key was depressed.
5888```html
5889<!doctype html>
5890<html lang="en">
5891<head>
5892 <meta charset="utf-8">
5893 <title>event.which demo</title>
5894 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5895</head>
5896<body>
5897
5898<input id="whichkey" value="type something">
5899<div id="log"></div>
5900
5901<script>
5902$( "#whichkey" ).on( "keydown", function( event ) {
5903 $( "#log" ).html( event.type + ": " + event.which );
5904});
5905</script>
5906
5907</body>
5908</html>
5909```
5910 * @example ​ ````Log which mouse button was depressed.
5911```html
5912<!doctype html>
5913<html lang="en">
5914<head>
5915 <meta charset="utf-8">
5916 <title>event.which demo</title>
5917 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5918</head>
5919<body>
5920
5921<input id="whichkey" value="click here">
5922<div id="log"></div>
5923
5924<script>
5925$( "#whichkey" ).on( "mousedown", function( event ) {
5926 $( "#log" ).html( event.type + ": " + event.which );
5927});
5928</script>
5929
5930</body>
5931</html>
5932```
5933 */
5934 which: number;
5935
5936 // MouseEvent, KeyboardEvent, TouchEvent
5937
5938 altKey: boolean;
5939 ctrlKey: boolean;
5940 /**
5941 * Indicates whether the META key was pressed when the event fired.
5942 * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
5943 * @since 1.0.4
5944 * @example ​ ````Determine whether the META key was pressed when the event fired.
5945```html
5946<!doctype html>
5947<html lang="en">
5948<head>
5949 <meta charset="utf-8">
5950 <title>event.metaKey demo</title>
5951 <style>
5952 body {
5953 background-color: #eef;
5954 }
5955 div {
5956 padding: 20px;
5957 }
5958 </style>
5959 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
5960</head>
5961<body>
5962
5963<button value="Test" name="Test" id="checkMetaKey">Click me!</button>
5964<div id="display"></div>
5965
5966<script>
5967$( "#checkMetaKey" ).click(function( event ) {
5968 $( "#display" ).text( event.metaKey );
5969});
5970</script>
5971
5972</body>
5973</html>
5974```
5975 */
5976 metaKey: boolean;
5977 shiftKey: boolean;
5978
5979 originalEvent?: _MouseEvent | undefined;
5980 }
5981
5982 interface ClickEvent<
5983 TDelegateTarget = any,
5984 TData = any,
5985 TCurrentTarget = any,
5986 TTarget = any,
5987 > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
5988 /**
5989 * The other DOM element involved in the event, if any.
5990 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
5991 * @since 1.1.4
5992 * @example ​ ````On mouseout of anchors, alert the element type being entered.
5993 ```javascript
5994 $( "a" ).mouseout(function( event ) {
5995 alert( event.relatedTarget.nodeName ); // "DIV"
5996 });
5997 ```
5998 */
5999 relatedTarget?: null | undefined;
6000
6001 type: "click";
6002 }
6003
6004 interface ContextMenuEvent<
6005 TDelegateTarget = any,
6006 TData = any,
6007 TCurrentTarget = any,
6008 TTarget = any,
6009 > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6010 /**
6011 * The other DOM element involved in the event, if any.
6012 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
6013 * @since 1.1.4
6014 * @example ​ ````On mouseout of anchors, alert the element type being entered.
6015 ```javascript
6016 $( "a" ).mouseout(function( event ) {
6017 alert( event.relatedTarget.nodeName ); // "DIV"
6018 });
6019 ```
6020 */
6021 relatedTarget?: null | undefined;
6022
6023 type: "contextmenu";
6024 }
6025
6026 interface DoubleClickEvent<
6027 TDelegateTarget = any,
6028 TData = any,
6029 TCurrentTarget = any,
6030 TTarget = any,
6031 > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6032 /**
6033 * The other DOM element involved in the event, if any.
6034 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
6035 * @since 1.1.4
6036 * @example ​ ````On mouseout of anchors, alert the element type being entered.
6037 ```javascript
6038 $( "a" ).mouseout(function( event ) {
6039 alert( event.relatedTarget.nodeName ); // "DIV"
6040 });
6041 ```
6042 */
6043 relatedTarget?: null | undefined;
6044
6045 type: "dblclick";
6046 }
6047
6048 interface MouseDownEvent<
6049 TDelegateTarget = any,
6050 TData = any,
6051 TCurrentTarget = any,
6052 TTarget = any,
6053 > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6054 /**
6055 * The other DOM element involved in the event, if any.
6056 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
6057 * @since 1.1.4
6058 * @example ​ ````On mouseout of anchors, alert the element type being entered.
6059 ```javascript
6060 $( "a" ).mouseout(function( event ) {
6061 alert( event.relatedTarget.nodeName ); // "DIV"
6062 });
6063 ```
6064 */
6065 relatedTarget?: null | undefined;
6066
6067 type: "mousedown";
6068 }
6069
6070 interface MouseEnterEvent<
6071 TDelegateTarget = any,
6072 TData = any,
6073 TCurrentTarget = any,
6074 TTarget = any,
6075 > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6076 // Special handling by jQuery.
6077 type: "mouseover";
6078 }
6079
6080 interface MouseLeaveEvent<
6081 TDelegateTarget = any,
6082 TData = any,
6083 TCurrentTarget = any,
6084 TTarget = any,
6085 > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6086 // Special handling by jQuery.
6087 type: "mouseout";
6088 }
6089
6090 interface MouseMoveEvent<
6091 TDelegateTarget = any,
6092 TData = any,
6093 TCurrentTarget = any,
6094 TTarget = any,
6095 > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6096 /**
6097 * The other DOM element involved in the event, if any.
6098 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
6099 * @since 1.1.4
6100 * @example ​ ````On mouseout of anchors, alert the element type being entered.
6101 ```javascript
6102 $( "a" ).mouseout(function( event ) {
6103 alert( event.relatedTarget.nodeName ); // "DIV"
6104 });
6105 ```
6106 */
6107 relatedTarget?: null | undefined;
6108
6109 type: "mousemove";
6110 }
6111
6112 interface MouseOutEvent<
6113 TDelegateTarget = any,
6114 TData = any,
6115 TCurrentTarget = any,
6116 TTarget = any,
6117 > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6118 type: "mouseout";
6119 }
6120
6121 interface MouseOverEvent<
6122 TDelegateTarget = any,
6123 TData = any,
6124 TCurrentTarget = any,
6125 TTarget = any,
6126 > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6127 type: "mouseover";
6128 }
6129
6130 interface MouseUpEvent<
6131 TDelegateTarget = any,
6132 TData = any,
6133 TCurrentTarget = any,
6134 TTarget = any,
6135 > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6136 /**
6137 * The other DOM element involved in the event, if any.
6138 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
6139 * @since 1.1.4
6140 * @example ​ ````On mouseout of anchors, alert the element type being entered.
6141 ```javascript
6142 $( "a" ).mouseout(function( event ) {
6143 alert( event.relatedTarget.nodeName ); // "DIV"
6144 });
6145 ```
6146 */
6147 relatedTarget?: null | undefined;
6148
6149 type: "mouseup";
6150 }
6151
6152 // region DragEvent
6153 // #region DragEvent
6154
6155 interface DragEventBase<
6156 TDelegateTarget = any,
6157 TData = any,
6158 TCurrentTarget = any,
6159 TTarget = any,
6160 > extends UIEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6161 originalEvent?: _DragEvent | undefined;
6162 }
6163
6164 interface DragEvent<
6165 TDelegateTarget = any,
6166 TData = any,
6167 TCurrentTarget = any,
6168 TTarget = any,
6169 > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6170 type: "drag";
6171 }
6172
6173 interface DragEndEvent<
6174 TDelegateTarget = any,
6175 TData = any,
6176 TCurrentTarget = any,
6177 TTarget = any,
6178 > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6179 type: "dragend";
6180 }
6181
6182 interface DragEnterEvent<
6183 TDelegateTarget = any,
6184 TData = any,
6185 TCurrentTarget = any,
6186 TTarget = any,
6187 > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6188 type: "dragenter";
6189 }
6190
6191 interface DragExitEvent<
6192 TDelegateTarget = any,
6193 TData = any,
6194 TCurrentTarget = any,
6195 TTarget = any,
6196 > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6197 type: "dragexit";
6198 }
6199
6200 interface DragLeaveEvent<
6201 TDelegateTarget = any,
6202 TData = any,
6203 TCurrentTarget = any,
6204 TTarget = any,
6205 > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6206 type: "dragleave";
6207 }
6208
6209 interface DragOverEvent<
6210 TDelegateTarget = any,
6211 TData = any,
6212 TCurrentTarget = any,
6213 TTarget = any,
6214 > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6215 type: "dragover";
6216 }
6217
6218 interface DragStartEvent<
6219 TDelegateTarget = any,
6220 TData = any,
6221 TCurrentTarget = any,
6222 TTarget = any,
6223 > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6224 type: "dragstart";
6225 }
6226
6227 interface DropEvent<
6228 TDelegateTarget = any,
6229 TData = any,
6230 TCurrentTarget = any,
6231 TTarget = any,
6232 > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6233 type: "drop";
6234 }
6235
6236 // #endregion
6237
6238 // #endregion
6239
6240 // region KeyboardEvent
6241 // #region KeyboardEvent
6242
6243 interface KeyboardEventBase<
6244 TDelegateTarget = any,
6245 TData = any,
6246 TCurrentTarget = any,
6247 TTarget = any,
6248 > extends UIEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6249 /**
6250 * The other DOM element involved in the event, if any.
6251 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
6252 * @since 1.1.4
6253 * @example ​ ````On mouseout of anchors, alert the element type being entered.
6254```javascript
6255$( "a" ).mouseout(function( event ) {
6256 alert( event.relatedTarget.nodeName ); // "DIV"
6257});
6258```
6259 */
6260 relatedTarget?: undefined;
6261
6262 // MouseEvent
6263
6264 button: undefined;
6265 buttons: undefined;
6266 clientX: undefined;
6267 clientY: undefined;
6268 offsetX: undefined;
6269 offsetY: undefined;
6270 /**
6271 * The mouse position relative to the left edge of the document.
6272 * @see \`{@link https://api.jquery.com/event.pageX/ }\`
6273 * @since 1.0.4
6274 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
6275```html
6276<!doctype html>
6277<html lang="en">
6278<head>
6279 <meta charset="utf-8">
6280 <title>event.pageX demo</title>
6281 <style>
6282 body {
6283 background-color: #eef;
6284 }
6285 div {
6286 padding: 20px;
6287 }
6288 </style>
6289 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6290</head>
6291<body>
6292
6293<div id="log"></div>
6294
6295<script>
6296$( document ).on( "mousemove", function( event ) {
6297 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
6298});
6299</script>
6300
6301</body>
6302</html>
6303```
6304 */
6305 pageX: undefined;
6306 /**
6307 * The mouse position relative to the top edge of the document.
6308 * @see \`{@link https://api.jquery.com/event.pageY/ }\`
6309 * @since 1.0.4
6310 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
6311```html
6312<!doctype html>
6313<html lang="en">
6314<head>
6315 <meta charset="utf-8">
6316 <title>event.pageY demo</title>
6317 <style>
6318 body {
6319 background-color: #eef;
6320 }
6321 div {
6322 padding: 20px;
6323 }
6324 </style>
6325 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6326</head>
6327<body>
6328
6329<div id="log"></div>
6330
6331<script>
6332$( document ).on( "mousemove", function( event ) {
6333 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
6334});
6335</script>
6336
6337</body>
6338</html>
6339```
6340 */
6341 pageY: undefined;
6342 screenX: undefined;
6343 screenY: undefined;
6344 /** @deprecated */
6345 toElement: undefined;
6346
6347 // PointerEvent
6348
6349 pointerId: undefined;
6350 pointerType: undefined;
6351
6352 // KeyboardEvent
6353
6354 /** @deprecated */
6355 char: string | undefined;
6356 /** @deprecated */
6357 charCode: number;
6358 code: string;
6359 key: string;
6360 /** @deprecated */
6361 keyCode: number;
6362
6363 // TouchEvent
6364
6365 changedTouches: undefined;
6366 targetTouches: undefined;
6367 touches: undefined;
6368
6369 // MouseEvent, KeyboardEvent
6370
6371 /**
6372 * For key or mouse events, this property indicates the specific key or button that was pressed.
6373 * @see \`{@link https://api.jquery.com/event.which/ }\`
6374 * @since 1.1.3
6375 * @example ​ ````Log which key was depressed.
6376```html
6377<!doctype html>
6378<html lang="en">
6379<head>
6380 <meta charset="utf-8">
6381 <title>event.which demo</title>
6382 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6383</head>
6384<body>
6385
6386<input id="whichkey" value="type something">
6387<div id="log"></div>
6388
6389<script>
6390$( "#whichkey" ).on( "keydown", function( event ) {
6391 $( "#log" ).html( event.type + ": " + event.which );
6392});
6393</script>
6394
6395</body>
6396</html>
6397```
6398 * @example ​ ````Log which mouse button was depressed.
6399```html
6400<!doctype html>
6401<html lang="en">
6402<head>
6403 <meta charset="utf-8">
6404 <title>event.which demo</title>
6405 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6406</head>
6407<body>
6408
6409<input id="whichkey" value="click here">
6410<div id="log"></div>
6411
6412<script>
6413$( "#whichkey" ).on( "mousedown", function( event ) {
6414 $( "#log" ).html( event.type + ": " + event.which );
6415});
6416</script>
6417
6418</body>
6419</html>
6420```
6421 */
6422 which: number;
6423
6424 // MouseEvent, KeyboardEvent, TouchEvent
6425
6426 altKey: boolean;
6427 ctrlKey: boolean;
6428 /**
6429 * Indicates whether the META key was pressed when the event fired.
6430 * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
6431 * @since 1.0.4
6432 * @example ​ ````Determine whether the META key was pressed when the event fired.
6433```html
6434<!doctype html>
6435<html lang="en">
6436<head>
6437 <meta charset="utf-8">
6438 <title>event.metaKey demo</title>
6439 <style>
6440 body {
6441 background-color: #eef;
6442 }
6443 div {
6444 padding: 20px;
6445 }
6446 </style>
6447 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6448</head>
6449<body>
6450
6451<button value="Test" name="Test" id="checkMetaKey">Click me!</button>
6452<div id="display"></div>
6453
6454<script>
6455$( "#checkMetaKey" ).click(function( event ) {
6456 $( "#display" ).text( event.metaKey );
6457});
6458</script>
6459
6460</body>
6461</html>
6462```
6463 */
6464 metaKey: boolean;
6465 shiftKey: boolean;
6466
6467 originalEvent?: _KeyboardEvent | undefined;
6468 }
6469
6470 interface KeyDownEvent<
6471 TDelegateTarget = any,
6472 TData = any,
6473 TCurrentTarget = any,
6474 TTarget = any,
6475 > extends KeyboardEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6476 type: "keydown";
6477 }
6478
6479 interface KeyPressEvent<
6480 TDelegateTarget = any,
6481 TData = any,
6482 TCurrentTarget = any,
6483 TTarget = any,
6484 > extends KeyboardEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6485 type: "keypress";
6486 }
6487
6488 interface KeyUpEvent<
6489 TDelegateTarget = any,
6490 TData = any,
6491 TCurrentTarget = any,
6492 TTarget = any,
6493 > extends KeyboardEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6494 type: "keyup";
6495 }
6496
6497 // #endregion
6498
6499 // region TouchEvent
6500 // #region TouchEvent
6501
6502 interface TouchEventBase<
6503 TDelegateTarget = any,
6504 TData = any,
6505 TCurrentTarget = any,
6506 TTarget = any,
6507 > extends UIEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6508 /**
6509 * The other DOM element involved in the event, if any.
6510 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
6511 * @since 1.1.4
6512 * @example ​ ````On mouseout of anchors, alert the element type being entered.
6513```javascript
6514$( "a" ).mouseout(function( event ) {
6515 alert( event.relatedTarget.nodeName ); // "DIV"
6516});
6517```
6518 */
6519 relatedTarget?: undefined;
6520
6521 // MouseEvent
6522
6523 button: undefined;
6524 buttons: undefined;
6525 clientX: undefined;
6526 clientY: undefined;
6527 offsetX: undefined;
6528 offsetY: undefined;
6529 /**
6530 * The mouse position relative to the left edge of the document.
6531 * @see \`{@link https://api.jquery.com/event.pageX/ }\`
6532 * @since 1.0.4
6533 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
6534```html
6535<!doctype html>
6536<html lang="en">
6537<head>
6538 <meta charset="utf-8">
6539 <title>event.pageX demo</title>
6540 <style>
6541 body {
6542 background-color: #eef;
6543 }
6544 div {
6545 padding: 20px;
6546 }
6547 </style>
6548 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6549</head>
6550<body>
6551
6552<div id="log"></div>
6553
6554<script>
6555$( document ).on( "mousemove", function( event ) {
6556 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
6557});
6558</script>
6559
6560</body>
6561</html>
6562```
6563 */
6564 pageX: undefined;
6565 /**
6566 * The mouse position relative to the top edge of the document.
6567 * @see \`{@link https://api.jquery.com/event.pageY/ }\`
6568 * @since 1.0.4
6569 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
6570```html
6571<!doctype html>
6572<html lang="en">
6573<head>
6574 <meta charset="utf-8">
6575 <title>event.pageY demo</title>
6576 <style>
6577 body {
6578 background-color: #eef;
6579 }
6580 div {
6581 padding: 20px;
6582 }
6583 </style>
6584 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6585</head>
6586<body>
6587
6588<div id="log"></div>
6589
6590<script>
6591$( document ).on( "mousemove", function( event ) {
6592 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
6593});
6594</script>
6595
6596</body>
6597</html>
6598```
6599 */
6600 pageY: undefined;
6601 screenX: undefined;
6602 screenY: undefined;
6603 /** @deprecated */
6604 toElement: undefined;
6605
6606 // PointerEvent
6607
6608 pointerId: undefined;
6609 pointerType: undefined;
6610
6611 // KeyboardEvent
6612
6613 /** @deprecated */
6614 char: undefined;
6615 /** @deprecated */
6616 charCode: undefined;
6617 key: undefined;
6618 /** @deprecated */
6619 keyCode: undefined;
6620
6621 // TouchEvent
6622
6623 changedTouches: TouchList;
6624 targetTouches: TouchList;
6625 touches: TouchList;
6626
6627 // MouseEvent, KeyboardEvent
6628
6629 /**
6630 * For key or mouse events, this property indicates the specific key or button that was pressed.
6631 * @see \`{@link https://api.jquery.com/event.which/ }\`
6632 * @since 1.1.3
6633 * @example ​ ````Log which key was depressed.
6634```html
6635<!doctype html>
6636<html lang="en">
6637<head>
6638 <meta charset="utf-8">
6639 <title>event.which demo</title>
6640 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6641</head>
6642<body>
6643
6644<input id="whichkey" value="type something">
6645<div id="log"></div>
6646
6647<script>
6648$( "#whichkey" ).on( "keydown", function( event ) {
6649 $( "#log" ).html( event.type + ": " + event.which );
6650});
6651</script>
6652
6653</body>
6654</html>
6655```
6656 * @example ​ ````Log which mouse button was depressed.
6657```html
6658<!doctype html>
6659<html lang="en">
6660<head>
6661 <meta charset="utf-8">
6662 <title>event.which demo</title>
6663 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6664</head>
6665<body>
6666
6667<input id="whichkey" value="click here">
6668<div id="log"></div>
6669
6670<script>
6671$( "#whichkey" ).on( "mousedown", function( event ) {
6672 $( "#log" ).html( event.type + ": " + event.which );
6673});
6674</script>
6675
6676</body>
6677</html>
6678```
6679 */
6680 which: undefined;
6681
6682 // MouseEvent, KeyboardEvent, TouchEvent
6683
6684 altKey: boolean;
6685 ctrlKey: boolean;
6686 /**
6687 * Indicates whether the META key was pressed when the event fired.
6688 * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
6689 * @since 1.0.4
6690 * @example ​ ````Determine whether the META key was pressed when the event fired.
6691```html
6692<!doctype html>
6693<html lang="en">
6694<head>
6695 <meta charset="utf-8">
6696 <title>event.metaKey demo</title>
6697 <style>
6698 body {
6699 background-color: #eef;
6700 }
6701 div {
6702 padding: 20px;
6703 }
6704 </style>
6705 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6706</head>
6707<body>
6708
6709<button value="Test" name="Test" id="checkMetaKey">Click me!</button>
6710<div id="display"></div>
6711
6712<script>
6713$( "#checkMetaKey" ).click(function( event ) {
6714 $( "#display" ).text( event.metaKey );
6715});
6716</script>
6717
6718</body>
6719</html>
6720```
6721 */
6722 metaKey: boolean;
6723 shiftKey: boolean;
6724
6725 originalEvent?: _TouchEvent | undefined;
6726 }
6727
6728 interface TouchCancelEvent<
6729 TDelegateTarget = any,
6730 TData = any,
6731 TCurrentTarget = any,
6732 TTarget = any,
6733 > extends TouchEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6734 type: "touchcancel";
6735 }
6736
6737 interface TouchEndEvent<
6738 TDelegateTarget = any,
6739 TData = any,
6740 TCurrentTarget = any,
6741 TTarget = any,
6742 > extends TouchEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6743 type: "touchend";
6744 }
6745
6746 interface TouchMoveEvent<
6747 TDelegateTarget = any,
6748 TData = any,
6749 TCurrentTarget = any,
6750 TTarget = any,
6751 > extends TouchEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6752 type: "touchmove";
6753 }
6754
6755 interface TouchStartEvent<
6756 TDelegateTarget = any,
6757 TData = any,
6758 TCurrentTarget = any,
6759 TTarget = any,
6760 > extends TouchEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6761 type: "touchstart";
6762 }
6763
6764 // #endregion
6765
6766 // region FocusEvent
6767 // #region FocusEvent
6768
6769 interface FocusEventBase<
6770 TDelegateTarget = any,
6771 TData = any,
6772 TCurrentTarget = any,
6773 TTarget = any,
6774 > extends UIEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
6775 /**
6776 * The other DOM element involved in the event, if any.
6777 * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
6778 * @since 1.1.4
6779 * @example ​ ````On mouseout of anchors, alert the element type being entered.
6780```javascript
6781$( "a" ).mouseout(function( event ) {
6782 alert( event.relatedTarget.nodeName ); // "DIV"
6783});
6784```
6785 */
6786 relatedTarget?: EventTarget | null | undefined;
6787
6788 // MouseEvent
6789
6790 button: undefined;
6791 buttons: undefined;
6792 clientX: undefined;
6793 clientY: undefined;
6794 offsetX: undefined;
6795 offsetY: undefined;
6796 /**
6797 * The mouse position relative to the left edge of the document.
6798 * @see \`{@link https://api.jquery.com/event.pageX/ }\`
6799 * @since 1.0.4
6800 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
6801```html
6802<!doctype html>
6803<html lang="en">
6804<head>
6805 <meta charset="utf-8">
6806 <title>event.pageX demo</title>
6807 <style>
6808 body {
6809 background-color: #eef;
6810 }
6811 div {
6812 padding: 20px;
6813 }
6814 </style>
6815 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6816</head>
6817<body>
6818
6819<div id="log"></div>
6820
6821<script>
6822$( document ).on( "mousemove", function( event ) {
6823 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
6824});
6825</script>
6826
6827</body>
6828</html>
6829```
6830 */
6831 pageX: undefined;
6832 /**
6833 * The mouse position relative to the top edge of the document.
6834 * @see \`{@link https://api.jquery.com/event.pageY/ }\`
6835 * @since 1.0.4
6836 * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
6837```html
6838<!doctype html>
6839<html lang="en">
6840<head>
6841 <meta charset="utf-8">
6842 <title>event.pageY demo</title>
6843 <style>
6844 body {
6845 background-color: #eef;
6846 }
6847 div {
6848 padding: 20px;
6849 }
6850 </style>
6851 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6852</head>
6853<body>
6854
6855<div id="log"></div>
6856
6857<script>
6858$( document ).on( "mousemove", function( event ) {
6859 $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
6860});
6861</script>
6862
6863</body>
6864</html>
6865```
6866 */
6867 pageY: undefined;
6868 screenX: undefined;
6869 screenY: undefined;
6870 /** @deprecated */
6871 toElement: undefined;
6872
6873 // PointerEvent
6874
6875 pointerId: undefined;
6876 pointerType: undefined;
6877
6878 // KeyboardEvent
6879
6880 /** @deprecated */
6881 char: undefined;
6882 /** @deprecated */
6883 charCode: undefined;
6884 key: undefined;
6885 /** @deprecated */
6886 keyCode: undefined;
6887
6888 // TouchEvent
6889
6890 changedTouches: undefined;
6891 targetTouches: undefined;
6892 touches: undefined;
6893
6894 // MouseEvent, KeyboardEvent
6895
6896 /**
6897 * For key or mouse events, this property indicates the specific key or button that was pressed.
6898 * @see \`{@link https://api.jquery.com/event.which/ }\`
6899 * @since 1.1.3
6900 * @example ​ ````Log which key was depressed.
6901```html
6902<!doctype html>
6903<html lang="en">
6904<head>
6905 <meta charset="utf-8">
6906 <title>event.which demo</title>
6907 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6908</head>
6909<body>
6910
6911<input id="whichkey" value="type something">
6912<div id="log"></div>
6913
6914<script>
6915$( "#whichkey" ).on( "keydown", function( event ) {
6916 $( "#log" ).html( event.type + ": " + event.which );
6917});
6918</script>
6919
6920</body>
6921</html>
6922```
6923 * @example ​ ````Log which mouse button was depressed.
6924```html
6925<!doctype html>
6926<html lang="en">
6927<head>
6928 <meta charset="utf-8">
6929 <title>event.which demo</title>
6930 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6931</head>
6932<body>
6933
6934<input id="whichkey" value="click here">
6935<div id="log"></div>
6936
6937<script>
6938$( "#whichkey" ).on( "mousedown", function( event ) {
6939 $( "#log" ).html( event.type + ": " + event.which );
6940});
6941</script>
6942
6943</body>
6944</html>
6945```
6946 */
6947 which: undefined;
6948
6949 // MouseEvent, KeyboardEvent, TouchEvent
6950
6951 altKey: undefined;
6952 ctrlKey: undefined;
6953 /**
6954 * Indicates whether the META key was pressed when the event fired.
6955 * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
6956 * @since 1.0.4
6957 * @example ​ ````Determine whether the META key was pressed when the event fired.
6958```html
6959<!doctype html>
6960<html lang="en">
6961<head>
6962 <meta charset="utf-8">
6963 <title>event.metaKey demo</title>
6964 <style>
6965 body {
6966 background-color: #eef;
6967 }
6968 div {
6969 padding: 20px;
6970 }
6971 </style>
6972 <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
6973</head>
6974<body>
6975
6976<button value="Test" name="Test" id="checkMetaKey">Click me!</button>
6977<div id="display"></div>
6978
6979<script>
6980$( "#checkMetaKey" ).click(function( event ) {
6981 $( "#display" ).text( event.metaKey );
6982});
6983</script>
6984
6985</body>
6986</html>
6987```
6988 */
6989 metaKey: undefined;
6990 shiftKey: undefined;
6991
6992 originalEvent?: _FocusEvent | undefined;
6993 }
6994
6995 interface BlurEvent<
6996 TDelegateTarget = any,
6997 TData = any,
6998 TCurrentTarget = any,
6999 TTarget = any,
7000 > extends FocusEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
7001 type: "blur";
7002 }
7003
7004 interface FocusEvent<
7005 TDelegateTarget = any,
7006 TData = any,
7007 TCurrentTarget = any,
7008 TTarget = any,
7009 > extends FocusEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
7010 type: "focus";
7011 }
7012
7013 interface FocusInEvent<
7014 TDelegateTarget = any,
7015 TData = any,
7016 TCurrentTarget = any,
7017 TTarget = any,
7018 > extends FocusEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
7019 type: "focusin";
7020 }
7021
7022 interface FocusOutEvent<
7023 TDelegateTarget = any,
7024 TData = any,
7025 TCurrentTarget = any,
7026 TTarget = any,
7027 > extends FocusEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
7028 type: "focusout";
7029 }
7030
7031 // #endregion
7032
7033 // #endregion
7034
7035 interface TypeToTriggeredEventMap<
7036 TDelegateTarget,
7037 TData,
7038 TCurrentTarget,
7039 TTarget,
7040 > {
7041 // Event
7042
7043 change: ChangeEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7044 resize: ResizeEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7045 scroll: ScrollEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7046 select: SelectEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7047 submit: SubmitEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7048
7049 // UIEvent
7050
7051 // MouseEvent
7052
7053 click: ClickEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7054 contextmenu: ContextMenuEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7055 dblclick: DoubleClickEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7056 mousedown: MouseDownEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7057 mouseenter: MouseEnterEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7058 mouseleave: MouseLeaveEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7059 mousemove: MouseMoveEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7060 mouseout: MouseOutEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7061 mouseover: MouseOverEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7062 mouseup: MouseUpEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7063
7064 // DragEvent
7065
7066 drag: DragEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7067 dragend: DragEndEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7068 dragenter: DragEnterEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7069 dragexit: DragExitEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7070 dragleave: DragLeaveEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7071 dragover: DragOverEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7072 dragstart: DragStartEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7073 drop: DropEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7074
7075 // KeyboardEvent
7076
7077 keydown: KeyDownEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7078 keypress: KeyPressEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7079 keyup: KeyUpEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7080
7081 // TouchEvent
7082
7083 touchcancel: TouchCancelEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7084 touchend: TouchEndEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7085 touchmove: TouchMoveEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7086 touchstart: TouchStartEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7087
7088 // FocusEvent
7089
7090 blur: BlurEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7091 focus: FocusEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7092 focusin: FocusInEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7093 focusout: FocusOutEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7094
7095 [type: string]: TriggeredEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
7096 }
7097
7098 // Extra parameters can be passed from trigger()
7099 type EventHandlerBase<TContext, T> = (this: TContext, t: T, ...args: any[]) => any;
7100
7101 type EventHandler<
7102 TCurrentTarget,
7103 TData = undefined,
7104 > = EventHandlerBase<TCurrentTarget, TriggeredEvent<TCurrentTarget, TData>>;
7105
7106 type TypeEventHandler<
7107 TDelegateTarget,
7108 TData,
7109 TCurrentTarget,
7110 TTarget,
7111 TType extends keyof TypeToTriggeredEventMap<TDelegateTarget, TData, TCurrentTarget, TTarget>,
7112 > = EventHandlerBase<
7113 TCurrentTarget,
7114 TypeToTriggeredEventMap<TDelegateTarget, TData, TCurrentTarget, TTarget>[TType]
7115 >;
7116
7117 interface TypeEventHandlers<
7118 TDelegateTarget,
7119 TData,
7120 TCurrentTarget,
7121 TTarget,
7122 > extends _TypeEventHandlers<TDelegateTarget, TData, TCurrentTarget, TTarget> {
7123 // No idea why it's necessary to include `object` in the union but otherwise TypeScript complains that
7124 // derived types of Event are not assignable to Event.
7125 [type: string]:
7126 | TypeEventHandler<TDelegateTarget, TData, TCurrentTarget, TTarget, string>
7127 | false
7128 | undefined
7129 | object;
7130 }
7131
7132 type _TypeEventHandlers<
7133 TDelegateTarget,
7134 TData,
7135 TCurrentTarget,
7136 TTarget,
7137 > = {
7138 [TType in keyof TypeToTriggeredEventMap<TDelegateTarget, TData, TCurrentTarget, TTarget>]?:
7139 | TypeEventHandler<TDelegateTarget, TData, TCurrentTarget, TTarget, TType>
7140 | false
7141 | object;
7142 };
7143
7144 // region Event extensions
7145 // #region Event extensions
7146
7147 interface EventExtensions {
7148 /**
7149 * The jQuery special event hooks are a set of per-event-name functions and properties that allow code to control the behavior of event processing within jQuery. The mechanism is similar to `fixHooks` in that the special event information is stored in `jQuery.event.special.NAME`, where `NAME` is the name of the special event. Event names are case sensitive.
7150 *
7151 * As with `fixHooks`, the special event hooks design assumes it will be very rare that two unrelated pieces of code want to process the same event name. Special event authors who need to modify events with existing hooks will need to take precautions to avoid introducing unwanted side-effects by clobbering those hooks.
7152 * @see \`{@link https://learn.jquery.com/events/event-extensions/#special-event-hooks }\`
7153 */
7154 special: SpecialEventHooks;
7155 }
7156
7157 // region Special event hooks
7158 // #region Special event hooks
7159
7160 /**
7161 * The jQuery special event hooks are a set of per-event-name functions and properties that allow code to control the behavior of event processing within jQuery. The mechanism is similar to `fixHooks` in that the special event information is stored in `jQuery.event.special.NAME`, where `NAME` is the name of the special event. Event names are case sensitive.
7162 *
7163 * As with `fixHooks`, the special event hooks design assumes it will be very rare that two unrelated pieces of code want to process the same event name. Special event authors who need to modify events with existing hooks will need to take precautions to avoid introducing unwanted side-effects by clobbering those hooks.
7164 * @see \`{@link https://learn.jquery.com/events/event-extensions/#special-event-hooks }\`
7165 */
7166 // Workaround for TypeScript 2.3 which does not have support for weak types handling.
7167 type SpecialEventHook<TTarget, TData> = {
7168 /**
7169 * Indicates whether this event type should be bubbled when the `.trigger()` method is called; by default it is `false`, meaning that a triggered event will bubble to the element's parents up to the document (if attached to a document) and then to the window. Note that defining `noBubble` on an event will effectively prevent that event from being used for delegated events with `.trigger()`.
7170 * @see \`{@link https://learn.jquery.com/events/event-extensions/#nobubble-boolean }\`
7171 */
7172 noBubble: boolean;
7173 } | {
7174 /**
7175 * When defined, these string properties specify that a special event should be handled like another event type until the event is delivered. The `bindType` is used if the event is attached directly, and the `delegateType` is used for delegated events. These types are generally DOM event types, and _should not_ be a special event themselves.
7176 * @see \`{@link https://learn.jquery.com/events/event-extensions/#bindtype-string-delegatetype-string }\`
7177 */
7178 bindType: string;
7179 } | {
7180 /**
7181 * When defined, these string properties specify that a special event should be handled like another event type until the event is delivered. The `bindType` is used if the event is attached directly, and the `delegateType` is used for delegated events. These types are generally DOM event types, and _should not_ be a special event themselves.
7182 * @see \`{@link https://learn.jquery.com/events/event-extensions/#bindtype-string-delegatetype-string }\`
7183 */
7184 delegateType: string;
7185 } | {
7186 /**
7187 * The setup hook is called the first time an event of a particular type is attached to an element; this provides the hook an opportunity to do processing that will apply to all events of this type on this element. The `this` keyword will be a reference to the element where the event is being attached and `eventHandle` is jQuery's event handler function. In most cases the `namespaces` argument should not be used, since it only represents the namespaces of the _first_ event being attached; subsequent events may not have this same namespaces.
7188 *
7189 * This hook can perform whatever processing it desires, including attaching its own event handlers to the element or to other elements and recording setup information on the element using the `jQuery.data()` method. If the setup hook wants jQuery to add a browser event (via `addEventListener` or `attachEvent`, depending on browser) it should return `false`. In all other cases, jQuery will not add the browser event, but will continue all its other bookkeeping for the event. This would be appropriate, for example, if the event was never fired by the browser but invoked by `.trigger()`. To attach the jQuery event handler in the setup hook, use the `eventHandle` argument.
7190 * @see \`{@link https://learn.jquery.com/events/event-extensions/#setup-function-data-object-namespaces-eventhandle-function }\`
7191 */
7192 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
7193 setup(this: TTarget, data: TData, namespaces: string, eventHandle: EventHandler<TTarget, TData>): void | false;
7194 } | {
7195 /**
7196 * The teardown hook is called when the final event of a particular type is removed from an element. The `this` keyword will be a reference to the element where the event is being cleaned up. This hook should return `false` if it wants jQuery to remove the event from the browser's event system (via `removeEventListener` or `detachEvent`). In most cases, the setup and teardown hooks should return the same value.
7197 *
7198 * If the setup hook attached event handlers or added data to an element through a mechanism such as `jQuery.data()`, the teardown hook should reverse the process and remove them. jQuery will generally remove the data and events when an element is totally removed from the document, but failing to remove data or events on teardown will cause a memory leak if the element stays in the document.
7199 * @see \`{@link https://learn.jquery.com/events/event-extensions/#teardown-function }\`
7200 */
7201 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
7202 teardown(this: TTarget): void | false;
7203 } | {
7204 /**
7205 * Each time an event handler is added to an element through an API such as `.on()`, jQuery calls this hook. The `this` keyword will be the element to which the event handler is being added, and the `handleObj` argument is as described in the section above. The return value of this hook is ignored.
7206 * @see \`{@link https://learn.jquery.com/events/event-extensions/#add-function-handleobj }\`
7207 */
7208 add(this: TTarget, handleObj: HandleObject<TTarget, TData>): void;
7209 } | {
7210 /**
7211 * When an event handler is removed from an element using an API such as `.off()`, this hook is called. The `this` keyword will be the element where the handler is being removed, and the `handleObj` argument is as described in the section above. The return value of this hook is ignored.
7212 * @see \`{@link https://learn.jquery.com/events/event-extensions/#remove-function-handleobj }\`
7213 */
7214 remove(this: TTarget, handleObj: HandleObject<TTarget, TData>): void;
7215 } | {
7216 /**
7217 * Called when the `.trigger()` or `.triggerHandler()` methods are used to trigger an event for the special type from code, as opposed to events that originate from within the browser. The `this` keyword will be the element being triggered, and the event argument will be a `jQuery.Event` object constructed from the caller's input. At minimum, the event type, data, namespace, and target properties are set on the event. The data argument represents additional data passed by `.trigger()` if present.
7218 *
7219 * The trigger hook is called early in the process of triggering an event, just after the `jQuery.Event` object is constructed and before any handlers have been called. It can process the triggered event in any way, for example by calling `event.stopPropagation()` or `event.preventDefault()` before returning. If the hook returns `false`, jQuery does not perform any further event triggering actions and returns immediately. Otherwise, it performs the normal trigger processing, calling any event handlers for the element and bubbling the event (unless propagation is stopped in advance or `noBubble` was specified for the special event) to call event handlers attached to parent elements.
7220 * @see \`{@link https://learn.jquery.com/events/event-extensions/#trigger-function-event-jquery-event-data-object }\`
7221 */
7222 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
7223 trigger(this: TTarget, event: Event, data: TData): void | false;
7224 } | {
7225 /**
7226 * When the `.trigger()` method finishes running all the event handlers for an event, it also looks for and runs any method on the target object by the same name unless of the handlers called `event.preventDefault()`. So, `.trigger( "submit" )` will execute the `submit()` method on the element if one exists. When a `_default` hook is specified, the hook is called just prior to checking for and executing the element's default method. If this hook returns the value `false` the element's default method will be called; otherwise it is not.
7227 * @see \`{@link https://learn.jquery.com/events/event-extensions/#_default-function-event-jquery-event-data-object }\`
7228 */
7229 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
7230 _default(event: TriggeredEvent<TTarget, TData>, data: TData): void | false;
7231 } | {
7232 /**
7233 * jQuery calls a handle hook when the event has occurred and jQuery would normally call the user's event handler specified by `.on()` or another event binding method. If the hook exists, jQuery calls it _instead_ of that event handler, passing it the event and any data passed from `.trigger()` if it was not a native event. The `this` keyword is the DOM element being handled, and `event.handleObj` property has the detailed event information.
7234 *
7235 * Based in the information it has, the handle hook should decide whether to call the original handler function which is in `event.handleObj.handler`. It can modify information in the event object before calling the original handler, but _must restore_ that data before returning or subsequent unrelated event handlers may act unpredictably. In most cases, the handle hook should return the result of the original handler, but that is at the discretion of the hook. The handle hook is unique in that it is the only special event function hook that is called under its original special event name when the type is mapped using `bindType` and `delegateType`. For that reason, it is almost always an error to have anything other than a handle hook present if the special event defines a `bindType` and `delegateType`, since those other hooks will never be called.
7236 * @see \`{@link https://learn.jquery.com/events/event-extensions/#handle-function-event-jquery-event-data-object }\`
7237 */
7238 handle(
7239 this: TTarget,
7240 event: TriggeredEvent<TTarget, TData> & { handleObj: HandleObject<TTarget, TData> },
7241 ...data: TData[]
7242 ): void;
7243 } | {
7244 // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
7245 preDispatch(this: TTarget, event: Event): false | void;
7246 } | {
7247 postDispatch(this: TTarget, event: Event): void;
7248 } | {
7249 [key: string]: any;
7250 };
7251
7252 interface SpecialEventHooks {
7253 [event: string]: SpecialEventHook<EventTarget, any>;
7254 }
7255
7256 /**
7257 * Many of the special event hook functions below are passed a `handleObj` object that provides more information about the event, how it was attached, and its current state. This object and its contents should be treated as read-only data, and only the properties below are documented for use by special event handlers.
7258 * @see \`{@link https://learn.jquery.com/events/event-extensions/#the-handleobj-object }\`
7259 */
7260 interface HandleObject<TTarget, TData> {
7261 /**
7262 * The type of event, such as `"click"`. When special event mapping is used via `bindType` or `delegateType`, this will be the mapped type.
7263 */
7264 readonly type: string;
7265 /**
7266 * The original type name regardless of whether it was mapped via `bindType` or `delegateType`. So when a "pushy" event is mapped to "click" its `origType` would be "pushy".
7267 */
7268 readonly origType: string;
7269 /**
7270 * Namespace(s), if any, provided when the event was attached, such as `"myPlugin"`. When multiple namespaces are given, they are separated by periods and sorted in ascending alphabetical order. If no namespaces are provided, this property is an empty string.
7271 */
7272 readonly namespace: string;
7273 /**
7274 * For delegated events, this is the selector used to filter descendant elements and determine if the handler should be called. For directly bound events, this property is `null`.
7275 */
7276 readonly selector: string | undefined | null;
7277 /**
7278 * The data, if any, passed to jQuery during event binding, e.g. `{ myData: 42 }`. If the data argument was omitted or `undefined`, this property is `undefined` as well.
7279 */
7280 readonly data: TData;
7281 /**
7282 * Event handler function passed to jQuery during event binding. If `false` was passed during event binding, the handler refers to a single shared function that simply returns `false`.
7283 */
7284 readonly handler: EventHandler<TTarget, TData>;
7285 }
7286
7287 // #endregion
7288
7289 // #endregion
7290
7291 // #endregion
7292
7293 interface NameValuePair {
7294 name: string;
7295 value: string;
7296 }
7297
7298 // region Coordinates
7299 // #region Coordinates
7300
7301 interface Coordinates {
7302 left: number;
7303 top: number;
7304 }
7305
7306 // Workaround for TypeScript 2.3 which does not have support for weak types handling.
7307 type CoordinatesPartial =
7308 | Pick<Coordinates, "left">
7309 | Pick<Coordinates, "top">
7310 | { [key: string]: never };
7311
7312 // #endregion
7313
7314 // region Val hooks
7315 // #region Val hooks
7316
7317 // Workaround for TypeScript 2.3 which does not have support for weak types handling.
7318 type ValHook<TElement> = {
7319 get(elem: TElement): any;
7320 } | {
7321 set(elem: TElement, value: any): any;
7322 } | {
7323 [key: string]: never;
7324 };
7325
7326 interface ValHooks {
7327 // Set to HTMLElement to minimize breaks but should probably be Element.
7328 [nodeName: string]: ValHook<HTMLElement>;
7329 }
7330
7331 // #endregion
7332
7333 type _Falsy = false | null | undefined | 0 | "" | typeof document.all;
7334}
7335
7336declare const jQuery: JQueryStatic;
7337declare const $: JQueryStatic;
7338
7339type _Event = Event;
7340type _UIEvent = UIEvent;
7341type _MouseEvent = MouseEvent;
7342type _DragEvent = DragEvent;
7343type _KeyboardEvent = KeyboardEvent;
7344type _TouchEvent = TouchEvent;
7345type _FocusEvent = FocusEvent;
7346
7347// region ES5 compatibility
7348// #region ES5 compatibility
7349
7350// Forward declaration of `Iterable<T>`.
7351// eslint-disable-next-line @typescript-eslint/no-empty-interface
7352interface Iterable<T> {}
7353
7354interface SymbolConstructor {
7355 /**
7356 * A String value that is used in the creation of the default string description of an object.
7357 * Called by the built-in method Object.prototype.toString.
7358 */
7359 readonly toStringTag: symbol;
7360}
7361
7362declare var Symbol: SymbolConstructor;
7363
7364// #endregion