-
Notifications
You must be signed in to change notification settings - Fork 0
Javascript
- Functions
- Contructor functions
- Function contructors
Promise.all(iterable);
Parameters
iterable : An iterable object such as an Array or String.
Return value
An already resolved Promise if the iterable passed is empty.
An asynchronously resolved Promise if the iterable passed contains no promises. Note, Google Chrome 58 returns an already resolved promise in this case.
A pending Promise in all other cases.
This returned promise is then resolved/rejected asynchronously (as soon as the stack is empty) when all the promises in the given iterable have resolved, or if any of the promises reject.
Returned values will be in order of the Promises passed, regardless of completion order.
Description: This method can be useful for aggregating the results of multiple promises.
Fulfillment: If an empty iterable is passed, then this method returns (synchronously) an already resolved promise. If all of the passed-in promises fulfill, or are not promises, the promise returned by Promise.all is fulfilled asynchronously. In all cases, the returned promise is fulfilled with an array containing all the values of the iterable passed as argument (also non-promise values).
Rejection: If any of the passed-in promises reject, Promise.all asynchronously rejects with the value of the promise that rejected, whether or not the other promises have resolved.