Type Alias: TimeoutOptions<T, BatchFuncName>
TimeoutOptions<
T,BatchFuncName> =object
Defined in: packages/promise/dist/index.d.ts:346
Options for PromisE.timeout()
Param
(optional) name of the supported PromiEBase static method to be used to resolve when more than one promise/function is provided. Default: "all"
Param
(optional) timeout duration in milliseconds. Default: 10_000 (10 seconds)
Type Parameters
T
T extends unknown[] = []
BatchFuncName
BatchFuncName extends string = "all"
Properties
abortCtrl?
optionalabortCtrl:AbortController
Defined in: packages/promise/dist/index.d.ts:354
An AbortController instance.
If provided:
- It will be aborted automatically when the timeout occurs.
- If it is aborted externally, the promise will be rejected and the timeout will be cleared.
abortOnEarlyFinalize?
optionalabortOnEarlyFinalize:boolean
Defined in: packages/promise/dist/index.d.ts:361
Whether to call abortCtrl.abort() if the promise is finalized externally (resolved or rejected before timeout or abort).
Default: true
batchFunc?
optionalbatchFunc:T["length"] extends0?never:T["length"] extends1?never:BatchFuncName
Defined in: packages/promise/dist/index.d.ts:367
The name of the PromisEBase static method to use for resolving multiple promises/functions.
Only applicable when more than one promise/function is provided.
onAbort()?
optionalonAbort: () =>ValueOrPromise<void|Error>
Defined in: packages/promise/dist/index.d.ts:373
Callback invoked when the promise is rejected due to an abort signal.
Can be used to transform the abort error by returning a custom Error object.
Returns
ValueOrPromise<void | Error>
onTimeout()?
optionalonTimeout: () =>ValueOrPromise<void|Error>
Defined in: packages/promise/dist/index.d.ts:379
Callback invoked when the promise times out.
Can be used to transform the timeout error by returning a custom Error object.
Returns
ValueOrPromise<void | Error>
signal?
optionalsignal:AbortSignal
Defined in: packages/promise/dist/index.d.ts:388
An AbortSignal to listen to.
If aborted:
- The promise will be rejected.
- The
abortCtrl(if provided and distinct) will be aborted. - The timeout will be cleared.
timeout?
optionaltimeout:number
Defined in: packages/promise/dist/index.d.ts:390
Timeout duration in milliseconds.