Construct a Timer
By default lazy
is false, which means it will eagerly reject
the timer, even if the handler has already started executing
If lazy
is true, this will make the timer wait for the handler
to finish executing
Note that passing a custom controller does not stop the default behaviour
Optional
handler: ((signal) => T | PromiseLike<T>)Optional
delay: numberOptional
lazy: booleanOptional
controller: PromiseCancellableControllerOptional
opts: { Optional
controller?: PromiseCancellableControllerOptional
delay?: numberOptional
handler?: ((signal) => T | PromiseLike<T>)Optional
lazy?: booleanProtected
_delayDelay in milliseconds
This may be Infinity
Protected
Optional
_scheduledTimestamp when this is scheduled to finish and execute the handler
Guaranteed to be weakly monotonic within the process lifetime
Compare this with performance.now()
not Date.now()
Protected
_statusThe status indicates when we have started settling or settled
Protected
abortAbort controller allows immediate cancellation
Protected
Optional
handlerHandler to be executed
Readonly
lazyIf it is lazy, the timer will not eagerly reject on cancellation if the handler has started executing
Protected
pDeconstructed promise
Protected
rejectPReject deconstructed promise
Optional
reason: anyProtected
resolvePResolve deconstructed promise
Optional
value: TProtected
Optional
timeoutInternal timeout reference
Readonly
timestampTimestamp when this is constructed
Guaranteed to be weakly monotonic within the process lifetime
Compare this with performance.now()
not Date.now()
Delay in milliseconds
This may be Infinity
Timestamp when this is scheduled to finish and execute the handler
Guaranteed to be weakly monotonic within the process lifetime
Compare this with performance.now()
not Date.now()
Protected
fulfillProtected
rejectOptional
onFulfilled: null | ((value, signal) => TResult1 | PromiseLike<TResult1>)Optional
onRejected: null | ((reason, signal) => TResult2 | PromiseLike<TResult2>)Optional
controller: PromiseCancellableControllerGenerated using TypeDoc
Just like
setTimeout
orsetInterval
, this will keep the NodeJS event loop alive