Abstract
Constructs a new promise.
Optional
executor: (The executor function that is called immediately when the promise is constructed. It
is passed two functions, resolve
and reject
, that can be called to resolve or
reject the promise respectively.
Readonly
[toReadonly
communicatorThe communicator associated with the asynchronous operation.
Readonly
operationThe operation name.
Readonly
proxyThe object proxy associated with the invocation.
Static
Readonly
[species]Cancels the asynchronous request.
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: () => voidThe callback to execute when the Promise is settled (fulfilled or rejected).
A Promise for the completion of the callback.
Whether the asynchronous request has completed.
true
if the asynchronous request has completed, false
otherwise.
Whether the asynchronous request has been sent.
true
if the asynchronous request has been sent, false
otherwise.
Rejects the promise with the specified reason.
The reason for rejecting the promise.
Whether the asynchronous request has been sent synchronously.
true
if the asynchronous request has been sent synchronously, false
otherwise.
Throws the exception if the asynchronous request was rejected with one; otherwise, does nothing.
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
delayReturns a promise that is resolved after a specified delay.
The number of milliseconds to delay.
A promise that is resolved after the specified delay.
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.
The
AsyncResult
class encapsulates the state of an asynchronous invocation. It extends the Promise class. It provides additional methods to support canceling the operation.