-
Notifications
You must be signed in to change notification settings - Fork 264
.when() documentation should say it takes Promises, not just Deferreds #906
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
Comments
Yep, that's a feature of version 3.0.0 which hasn't been released yet. I don't see a commit in the 3.0 api docs branch yet though so thanks for the reminder! There is a mention of it in the 3.0 upgrade guide already, which is taking shape here. If you'd like to help by reviewing the major issues there and creating pull requests for the docs that would be much appreciated. Also you have comment on the upgrade guide draft so any input there is welcome too. Edit: ref jquery/jquery#1722 |
@dmethvin Actually my comment applies to jQuery 2. You can not only pass Deferreds to .when() - you can also pass promises from Deferred.promise(). Promises are more general than Deferreds. That is why I think the documentation for $.when() should say that it takes Promises, not just Deferreds. |
Said that, In conclusion, I think we should specify all these types and not replace |
@AurelioDeRosa Since Deferred is a superset of Promise, then if you say that $.when accepts Promise-like objects, that includes Deferreds, Promises, and Promise-like objects. So wouldn't it make more sense to just say that $.when accepts Promise-like objects? |
For jQuery 1.x/2.x it only accepts For jQuery 3.0 it also accepts any "thenable" including an ES6 Promise. We will probably want to change our use of the type name |
The documentation for $.when() says that it takes Deferreds. However, it later implies that it can take Deferreds or Promises:
If so, then the documentation should be updated to say that $.when() takes Promises, not just Deferreds. Promises are more general than Deferreds.
In my testing, $.when() works with Promises, not just Deferreds.
The text was updated successfully, but these errors were encountered: