Creates a new Promise.
A callback used to initialize the promise. This callback is passed two arguments: a resolve callback used to resolve the promise with a value or the result of another promise, and a reject callback used to reject the promise with a provided reason or 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 asynchronously using the optional
provided timeout value to schedule when the chained items will be executed, or if the input contains no promises.
It rejects immediately upon any of the input promises rejected or non-promises throwing an error,
and will reject with this first rejection message / error.
When resolved or rejected any additional chained operations will execute asynchronously using the optional
timeout value to schedul when the chained item will be executed (eg. then()
; catch()
; finally()
).
The array of promises to wait to be resolved / rejected before resolving or rejecting the new promise
Optional
timeout: numberOptional timeout to wait before processing the items, defaults to zero.
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 Asynchronous 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.
An array of promises to wait to be resolved / rejected before resolving or rejecting the new promise
Optional
timeout: numberOptional timeout to wait before processing the items, defaults to zero, only used when Native promises are not available.
A pending Promise
that will resolve to an array of IPromiseResult objects that each describe the outcome of each promise.
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 Asynchronous 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.
The createAsyncAnyPromise
method takes an iterable of promises as input and returns a single Promise.
This returned promise fulfills when any of the input's promises fulfills, with this first fulfillment value.
It rejects when all of the input's promises reject (including when an empty iterable is passed), with an
AggregateError containing an array of rejection reasons.
A new Promise that is:
The createAsyncAnyPromise
method takes an iterable of promises as input and returns a single Promise.
This returned promise fulfills when any of the input's promises fulfills, with this first fulfillment value.
It rejects when all of the input's promises reject (including when an empty iterable is passed), with an
AggregateError containing an array of rejection reasons.
An iterable object of promises.
Optional
timeout: numberOptional timeout to wait before processing the items, defaults to zero, only used when Native promises are not available.
A new Promise that is:
The createAsyncRacePromise
method takes an array of promises as input and returns a single Promise. This returned promise
settles with the eventual state of the first promise that settles.
A Promise that settles with the eventual state of the first promise in the iterable to settle. In other words, it fulfills if the first promise to settle is fulfilled, and rejects if the first promise to settle is rejected. The returned promise remains pending forever if the iterable passed is empty. If the iterable passed is non-empty but contains no pending promises, the returned promise is still asynchronously settled.
The createAsyncRacePromise
method is one of the promise concurrency methods. It's useful when you want the first
async task to complete, but do not care about its eventual state (i.e. it can either succeed or fail).
If the iterable contains one or more non-promise values and/or an already settled promise, then Promise.race() will settle to
the first of these values found in the iterable.
The createAsyncRacePromise
method takes an array of promises as input and returns a single Promise. This returned promise
settles with the eventual state of the first promise that settles.
An iterable object of promises.
Optional
timeout: numberOptional timeout to wait before processing the items, defaults to zero, only used when Native promises are not available.
A Promise that settles with the eventual state of the first promise in the iterable to settle. In other words, it fulfills if the first promise to settle is fulfilled, and rejects if the first promise to settle is rejected. The returned promise remains pending forever if the iterable passed is empty. If the iterable passed is non-empty but contains no pending promises, the returned promise is still asynchronously settled.
The createAsyncRacePromise
method is one of the promise concurrency methods. It's useful when you want the first
async task to complete, but do not care about its eventual state (i.e. it can either succeed or fail).
If the iterable contains one or more non-promise values and/or an already settled promise, then Promise.race() will settle to
the first of these values found in the iterable.
Returns a single asynchronous Promise instance that is already rejected with the given reason.
Any chained operations will execute asynchronously using the optional timeout value to schedule
when then chained items will be executed. (eg. catch()
; finally()
).
Optional
reason: anyThe rejection reason
Optional
timeout: numberOptional timeout to wait before processing the items, defaults to zero.
A rejected promise.
Returns a single asynchronous Promise instance that is already resolved with the given value. If the value passed is
a promise then that promise is returned instead of creating a new asynchronous promise instance.
If a new instance is returned then any chained operations will execute asynchronously using the optional
timeout value to schedule when the chained items will be executed.(eg. then()
; finally()
).
A resolved promise.
Returns a single asynchronous Promise instance that is already resolved with the given value. If the value passed is
a promise then that promise is returned instead of creating a new asynchronous promise instance.
If a new instance is returned then any chained operations will execute asynchronously using the optional
timeout value to schedule when the chained items will be executed.(eg. then()
; finally()
).
A resolved promise.
The PolyPromiseConstructor interface represents the constructor for the polyfill Promise object.
Since
0.5.0