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