Promise.settle -> can it return an array of the promises instead?
See original GitHub issueInstead of PromiseInspection results?
I think a really useful method would be Promise.allSettled, similar to Q.allSettled - where you wait for all of the promises to be fulfilled, and return a promise which is fulfilled if all of the promises had been resolved, and rejected if at least one had been rejected.
In other words:
Promise.allSettled([promises]).then(function(){ ... }).catch(function(){...})
Would be equivalent to:
Promise.settle([promises]).all().then(function(){ ... }).catch(function(){...})
if Promise.settle returned an array of promises or if Promise.all could receive an array of PromiseInspection results and work on it.
May I submit a PR to be considered?
Issue Analytics
- State:
- Created 9 years ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
Promise.allSettled() - JavaScript - MDN Web Docs
The Promise.allSettled() method takes an iterable of promises as input and returns a single Promise . This returned promise fulfills when all of...
Read more >How to Use Promise.allSettled() - Dmitri Pavlutin
The promise returned by Promise.allSettled() always fulfills with an array of statuses, no matter if some (or even all!) input promises are ...
Read more >Return complete array from Promise - javascript - Stack Overflow
In that case, yes, you need a Promise to be returned from updateTopStories() . See MDN on promises. In the example provided there,...
Read more >How to Sequentially Resolve an Array of Promises in JavaScript
And the new function is reusable whenever you need to process Promises sequentially. * Thanks to getify for recommending using the await within ......
Read more >JavaScript Promises: race, all, allSettled, and then
With promise methods like Promise.all() — which takes an array of promises as an argument a returns a promise that resolves when all...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I thought there was, but testing it out, I see there isn’t. Thanks, I’ll test it further and close the issue if it’s no longer relevant.
I still believe this would be useful as a single utility method though, as Promise.allSettled
@EtaiG , an advanced version of it: spex.batch