Sequential Q.all()
See original GitHub issueFrom the docs
“You can turn an array of promises into a promise for the whole, fulfilled array using Q.all
”
“If you have a number of promise-producing functions that need to be run sequentially, you can […] use the ultra-compact version. return funcs.reduce(Q.when, Q(initialVal));
”
Problems
- The first approach returns a promise which eventually resolves to an array of values but it’s not guaranteed to be sequential.
- The second approach is guaranteed to be sequential but returns a promise that eventually resolves to only one of the async calculated values.
Request
Provide a means of Q.all()
which is guaranteed to execute sequentially
Please if I’m missing anything and you can do this already somehow, let me know! Thanks 😃
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top Results From Across the Web
How do I sequentially chain promises with angularjs $q?
Redgeoff, your own answer is the way I used to translate an array into a chained series of promises. The emergent de facto...
Read more >$q.all() - Combining promises in AngularJS | ryansouthgate.com
$q.all() allows us to wait on an array (or object) of promises, ... on the previous - in that the promises need to...
Read more >$q - AngularJS: API
A new instance of deferred is constructed by calling $q.defer() . The purpose of the deferred object is to expose the associated Promise...
Read more >Promise.all() - JavaScript - MDN Web Docs
The Promise.all() method takes an iterable of promises as input and returns a single Promise . This returned promise fulfills when all of ......
Read more >Why Using reduce() to Sequentially Resolve Promises Works
When we use it to sequentially resolve promises, the reduce() loop isn't actually slowing down at all. It's completely synchronous, doing ...
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
You do! 😉
Yes, thanks for the code! It makes perfectly sense but it’s really really verbose. That’s why I’m asking for an additional method on Q like Q.all() but sequential. Q.sequentiAll() (pun intended)…
posible solution