UNPKG

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