Deferred <T>
Implements
- Promise<T>
Index
Constructors
publicconstructor
Type parameters
- T
Returns Deferred<T>
Accessors
public[toStringTag]
Returns a string representation of the object.
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: any) => TResult | PromiseLike<TResult>
Returns Promise<T | TResult>
publicfinally
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
Parameters
optionalonfinally: null | () => void
The callback to execute when the Promise is settled (fulfilled or rejected).
Returns Promise<T>
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: any) => TResult2 | PromiseLike<TResult2>
The callback to execute when the promise is rejected.
Returns Promise<TResult1 | TResult2>
Represents a deferred promise.