Deferred <T>
Implements
- PromiseLike<T>
Index
Constructors
publicconstructor
Type parameters
- T
Returns Deferred<T>
Accessors
public[toStringTag]
A String value that is used in the creation of the default string description of an object. Called by the built-in method Object.prototype.toString.
Returns string
publicstate
Gets the current state of the deferred promise.
Returns DeferredState
Methods
publiccatch
Attaches a callback for only the rejection of the Promise.
Type parameters
- TResult = never
Parameters
optionalonrejected: null | (reason: unknown) => TResult | PromiseLike<TResult>
The callback to execute when the Promise is rejected.
Returns Promise<T | TResult>
A Promise for the completion of the callback.
publicfinally
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
Parameters
optionalonfinally: null | () => void
The callback to execute when the Promise is settled (fulfilled or rejected).
Returns Promise<T>
A Promise for the completion of the callback.
publicreject
Rejects the promise with a reason.
Parameters
optionalreason: any
The reason why the promise was rejected.
Returns void
publicresolve
Resolves the promise with a value or the result of another promise.
Parameters
value: T | PromiseLike<T>
The value to resolve the promise with.
Returns void
publicthen
Attaches callbacks for the resolution and/or rejection of the Promise.
Type parameters
- TResult1 = T
- TResult2 = never
Parameters
optionalonfulfilled: null | (value: T) => TResult1 | PromiseLike<TResult1>
The callback to execute when the Promise is resolved.
optionalonrejected: null | (reason: unknown) => TResult2 | PromiseLike<TResult2>
The callback to execute when the Promise is rejected.
Returns Promise<TResult1 | TResult2>
A Promise for the completion of which ever callback is executed.
Represents a deferred promise.