Readonly
[toStatic
Readonly
[species]Attaches a callback for only the rejection of the Promise.
Optional
rej: ((err: any) => any)A Promise for the completion of the callback.
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
Optional
res: (() => any)A Promise for the completion of the callback.
Attaches callbacks for the resolution and/or rejection of the Promise.
A Promise for the completion of which ever callback is executed.
Static
allCreates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
A new Promise.
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
An array of Promises.
A new Promise.
Static
allCreates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.
An array of Promises.
A new Promise.
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.
A new Promise.
Static
anyThe any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
An array or iterable of Promises.
A new Promise.
The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
A new Promise.
Static
fromStatic
raceCreates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
A new Promise.
Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
An array of Promises.
A new Promise.
Static
rejectStatic
resolveCreates a new resolved promise.
A resolved promise.
Creates a new resolved promise for the provided value.
A promise.
A promise whose internal state matches the provided promise.
Creates a new resolved promise for the provided value.
A promise whose internal state matches the provided promise.
Static
withCreates a new Promise and returns it in an object, along with its resolve and reject functions.
An object with the properties promise
, resolve
, and reject
.
const { promise, resolve, reject } = Promise.withResolvers<T>();
A promise that fires the
onProgress
callback on incremental progressExample