Returns a single asynchronous 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 using native environment promise implementation, if the runtime does not provide any native then the optional provided timeout value will be used 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 = [
createNativeResolvedPromise(1),
createNativeResolvedPromise(2),
createNativeResolvedPromise(3),
createNativeRejectedPromise("error"),
];
const results = await createNativeAllSettledPromise(promises);
// results is:
// [
// { status: "fulfilled", value: 1 },
// { status: "fulfilled", value: 2 },
// { status: "fulfilled", value: 3 },
// { status: "rejected", reason: "error" }
// ]
Returns a single asynchronous 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 using native environment promise implementation, if the runtime does not provide any native then the optional provided timeout value will be used 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