Task <Payload, Result>
Hierarchy
- Deferred<Result>
- Task
Index
Constructors
publicconstructor
Type parameters
- Payload
- Result
Parameters
payload: Payload
Returns Task<Payload, Result>
Accessors
[toStringTag]
Returns string
publicpayload
Returns Payload
publicsignal
Returns AbortSignal
state
Gets the current state of the deferred promise.
Returns DeferredState
Methods
catch
Attaches a callback for only the rejection of the promise.
Type parameters
- TResult = never
Parameters
optionalonrejected: null | (reason: any) => TResult | PromiseLike<TResult>
Returns Promise<Result | TResult>
finally
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<Result>
reject
Rejects the promise with a reason.
Parameters
optionalreason: any
The reason why the promise was rejected.
Returns void
resolve
Resolves the promise with a value or the result of another promise.
Parameters
value: Result | PromiseLike<Result>
The value to resolve the promise with.
Returns void
publicshare
Parameters
optionalsignal: AbortSignal
Returns Promise<Result>
then
Attaches callbacks for the resolution and/or rejection of the promise.
Type parameters
- TResult1 = Result
- TResult2 = never
Parameters
optionalonfulfilled: null | (value: Result) => 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>
Returns a string representation of the object.