Readonly
[toReadonly
placeholderStatic
Readonly
[species]Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
Optional
onfinally: null | (() => void)The callback to execute when the Promise is settled (fulfilled or rejected).
A Promise for the completion of the callback.
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.
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.
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
raceStatic
rejectCreates a new rejected promise for the provided reason.
Optional
reason: anyThe reason the promise was rejected.
A new rejected Promise.
Static
resolveCreates a new resolved promise.
A resolved promise.
Static
tryTakes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result in a Promise.
A Promise that is:
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, with the additional property
placeholderUrl
which can be used until the promise resolves with a better image asset.