Returns a single Promise instance that resolves to an array of the results from the input promises. This returned promise will resolve and execute it's pending chained operations based on the Aasynchronous promise implementation. Any chained operations will execute asynchronously when the final operation pending promises have resolved, or if the input contains no promises. It will resolve only after all of the input promises have either resolved or rejected, and will resolve with an array of IPromiseResult objects that each describe the outcome of each promise.
A pending Promise
that will resolve to an array of IPromiseResult objects that each describe the outcome of each promise.
const promises = [
createResolvedPromise(1),
createResolvedPromise(2),
createResolvedPromise(3),
createRejectedPromise("error"),
];
const results = await createAllSettledPromise(promises);
// results is:
// [
// { status: "fulfilled", value: 1 },
// { status: "fulfilled", value: 2 },
// { status: "fulfilled", value: 3 },
// { status: "rejected", reason: "error" }
// ]
Returns a single Promise instance that resolves to an array of the results from the input promises. This returned promise will resolve and execute it's pending chained operations based on the Aasynchronous promise implementation. Any chained operations will execute asynchronously when the final operation pending promises have resolved, or if the input contains no promises. It will resolve only after all of the input promises have either resolved or rejected, and will resolve with an array of IPromiseResult objects that each describe the outcome of each promise.
Since
0.5.0
Param: input
An array of promises to wait to be resolved / rejected before resolving or rejecting the new promise
Param: timeout
Optional timeout to wait before processing the items, defaults to zero, only used when Native promises are not available.
Returns
A pending
Promise
that will resolve to an array of IPromiseResult objects that each describe the outcome of each promise.Example