DEV Community

Discussion on: The future of Javascript - features to keep an eye on

Collapse
 
victorcorcos profile image
Victor Cordeiro Costa • Edited

Looks like Promise.allSettled is the same as $.when() which is provided by jQuery, am I correct?
Both of them returns a Promise that will be executed when the inner promises are done.

I prefer 200% the when syntax than the allSettled.

Promise.when([promise1, promise2]).done...
Enter fullscreen mode Exit fullscreen mode

Sound so much more succinct and readable!

Collapse
 
nlepage profile image
Nicolas Lepage

No, $.when() is like Promise.all(), they both fail/reject as soon as one of the given promises rejects.
Promise.allSettled will resolve when all given promises have either resolved or rejected, and then you have to manually check the results...

Collapse
 
victorcorcos profile image
Victor Cordeiro Costa

Great! Thanks for the response!