Web3DeferredPromise <T>
Implements
- Promise<T>
- Web3DeferredPromiseInterface<T>
Index
Constructors
Properties
Accessors
Methods
Constructors
publicconstructor
Type parameters
- T
Parameters
__namedParameters: { eagerStart: boolean; timeout: number; timeoutMessage: string } = ...
eagerStart: boolean
timeout: number
timeoutMessage: string
Returns Web3DeferredPromise<T>
Properties
public[toStringTag]
Accessors
publicstate
Returns the current state of the promise.
Returns pending | fulfilled | rejected
'pending' | 'fulfilled' | 'rejected'
Methods
publiccatch
Type parameters
- TResult
Parameters
optionalonrejected: (reason: any) => TResult | PromiseLike<TResult>
(optional) The callback to execute when the promise is rejected.
Returns Promise<T | TResult>
publicfinally
Parameters
optionalonfinally: () => void
(optional) The callback to execute when the promise is settled (fulfilled or rejected).
Returns Promise<T>
publicreject
Rejects the current promise.
Parameters
optionalreason: unknown
The reason to reject the promise with.
Returns void
publicresolve
Resolves the current promise.
Parameters
value: T | PromiseLike<T>
The value to resolve the promise with.
Returns void
publicstartTimer
Starts the timeout timer for the promise.
Returns void
publicthen
Type parameters
- TResult1
- TResult2
Parameters
optionalonfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>
(optional) The callback to execute when the promise is fulfilled.
optionalonrejected: (reason: unknown) => TResult2 | PromiseLike<TResult2>
(optional) The callback to execute when the promise is rejected.
Returns Promise<TResult1 | TResult2>
The class is a simple implementation of a deferred promise with optional timeout functionality, which can be useful when dealing with asynchronous tasks.