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 current promise implementation. If the current implementation is synchronous then the chained operations will execute synchronously in the same execution cycle as the final operation pending promises have resolved, or if the input contains no promises. If the current implementation is asynchronous then the chained operations will execute asynchronously using the optional provided timeout value to schedule when the chained items will be executed 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 current promise implementation. If the current implementation is synchronous then the chained operations will execute synchronously in the same execution cycle as the final operation pending promises have resolved, or if the input contains no promises. If the current implementation is asynchronous then the chained operations will execute asynchronously using the optional provided timeout value to schedule when the chained items will be executed 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