-
Notifications
You must be signed in to change notification settings - Fork 97
Docs: Describe jQuery.when split paths #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -347,14 +347,24 @@ https://github.com/jquery/jquery/issues/1722 | |
| https://github.com/jquery/jquery/issues/2102 | ||
| https://github.com/jquery/jquery/issues/2736 | ||
|
|
||
| #### Breaking change and Feature: $.when() inputs and progress notifications | ||
| #### Breaking change and Feature: $.when() arguments | ||
|
|
||
| The $.when() method now interprets that any input argument with a `.then()` method is a Promise or Deferred compatible object. In previous versions, if a single Deferred was passed as an input argument, `$.when()` would re-use it and return it as the output Deferred. Now, it *always* returns a new Deferred. This allows any type of`then`-able to be passed as input, including native ES6 Promise or Bluebird promises. You can also convert to the output Deferred to an ES6 promise with `Promise.resolve()` where native Promise is supported. | ||
| `$.when` now interprets any input argument with a `then` method as a Promise-compatible "[thenable](https://promisesaplus.com/#point-7)". This allows a much broader range of inputs, including native ES6 Promises and Bluebird promises. | ||
|
|
||
| Further, a more clear distinction is now recognized between multi-argument calls to `$.when` and single- or no-argument calls. | ||
| Multi-argument calls behave similarly to `Promise.all`, aggregating fulfillment values into a fulfillment array (with jQuery-specific enhancements of also aggregating fulfillment contexts and supporting multi-valued fulfillments), or alternatively rejecting with the first rejection value. | ||
| Single- and no-argument calls behave similarly to `Promise.resolve`, returning a Deferred that resolves identically to thenable or Promise-like input, or fulfills with its non-Promise input (as appropriate). | ||
| As of jQuery 3.0, both of these return a new Deferred (previous versions did not create a new Deferred when called with a single Deferred input). | ||
|
|
||
| https://github.com/jquery/jquery/issues/2018 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do these have two spaces after them to create a line break? I can't tell.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I didn't realize why they were present until their removal borked the GitHub rich diff.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah and they call html markup obscure. 😈 Another option would be to put them all on one line but turn them into links, something like |
||
| https://github.com/jquery/jquery/issues/2546 | ||
| https://github.com/jquery/jquery/issues/3029 | ||
|
|
||
| #### Breaking change: $.when() progress notifications | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 Good call on breaking this out |
||
|
|
||
| As of jQuery 3.0, the `$.when()` method no longer passes along progress notifications from input Deferreds to the output Deferred. Progress messages are not part of the Promises/A+ specification, and the behavior of progress notifications in `$.when()` were not previously documented in the jQuery API. | ||
|
|
||
| https://github.com/jquery/jquery/issues/2710 | ||
| https://github.com/jquery/jquery/issues/2546 | ||
|
|
||
|
|
||
| ### Dimensions | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make any assertions about the result being sync or async?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think any relevant changes are covered in the Deferred section, especially if jquery/jquery#3105 lands.