The createSyncRacePromise
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 will settle synchronously.
The createSyncRacePromise
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
createSyncRacePromise
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.Description
The
createSyncRacePromise
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.Since
0.5.0
Param: values
An the array of promises.
Param: timeout
Optional timeout to wait before processing the items, defaults to zero, only used when Native promises are not available.
Returns
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 will settle synchronously.