Skip to content

Type Alias: DeferredAsyncOptions<ThisArg, DelayMs>

DeferredAsyncOptions<ThisArg, DelayMs> = object & object & Omit<ThrottleOptions, "onError" | "ThisArg" | "tid"> | object & Omit<DeferredOptions, "onError" | "ThisArg" | "tid">

Defined in: packages/promise/src/types/deferred.ts:25

Options for PromisE.deferred and other related functions

Type Declaration

onError()?

optional onError: (this, err) => ValueOrPromise<unknown>

Callback invoked whenever promise/function throws error

Parameters

this

ThisArg

err

unknown

Returns

ValueOrPromise<unknown>

onIgnore()?

optional onIgnore: (this, ignored) => ValueOrPromise<unknown>

Whenever a promise/function is ignored when in debource/throttle mode, onIgnored wil be invoked. The promise/function will not be invoked, unless it's manually invoked using the ignored function. Use for debugging or logging purposes.

Parameters

this

ThisArg

ignored

DeferredAsyncGetPromise<unknown>

Returns

ValueOrPromise<unknown>

onResult()?

optional onResult: (this, result?) => ValueOrPromise<unknown>

Whenever a promise/function is executed successfully onResult will be called. Those that are ignored but resolve with last will not cause onResult to be invoked.

Result can be undefined if ResolveIgnored.WITH_UNDEFINED is used.

Parameters

this

ThisArg

result?

any

Returns

ValueOrPromise<unknown>

resolveError?

optional resolveError: ResolveError

What do to when an executed function/promise throws error See ResolveError for available options.

resolveIgnored?

optional resolveIgnored: ResolveIgnored

Indicates what to do when a promise in the queue is ignored. See ResolveIgnored for available options.

thisArg?

optional thisArg: ThisArg

The value to be used as "thisArg" whenever any of the callbacks are invoked

Type Parameters

ThisArg

ThisArg = unknown

DelayMs

DelayMs extends number = number