Framework
Version
防抖器 API 參考
節流器 API 參考
速率限制器 API 參考
佇列 API 參考

AsyncDebouncerOptions

Interface: AsyncDebouncerOptions<TFn>

Defined in: async-debouncer.ts:6

Options for configuring an async debounced function

Type Parameters

TFn extends AnyAsyncFunction

Properties

enabled?

ts
optional enabled: boolean;
optional enabled: boolean;

Defined in: async-debouncer.ts:11

Whether the debouncer is enabled. When disabled, maybeExecute will not trigger any executions. Defaults to true.


leading?

ts
optional leading: boolean;
optional leading: boolean;

Defined in: async-debouncer.ts:16

Whether to execute on the leading edge of the timeout. Defaults to false.


onError()?

ts
optional onError: (error, debouncer) => void;
optional onError: (error, debouncer) => void;

Defined in: async-debouncer.ts:20

Optional error handler for when the debounced function throws

Parameters

error

unknown

debouncer

AsyncDebouncer<TFn>

Returns

void


onSettled()?

ts
optional onSettled: (debouncer) => void;
optional onSettled: (debouncer) => void;

Defined in: async-debouncer.ts:24

Optional callback to call when the debounced function is executed

Parameters

debouncer

AsyncDebouncer<TFn>

Returns

void


onSuccess()?

ts
optional onSuccess: (result, debouncer) => void;
optional onSuccess: (result, debouncer) => void;

Defined in: async-debouncer.ts:28

Optional callback to call when the debounced function is executed

Parameters

result

ReturnType<TFn>

debouncer

AsyncDebouncer<TFn>

Returns

void


trailing?

ts
optional trailing: boolean;
optional trailing: boolean;

Defined in: async-debouncer.ts:33

Whether to execute on the trailing edge of the timeout. Defaults to true.


wait

ts
wait: number;
wait: number;

Defined in: async-debouncer.ts:38

Delay in milliseconds to wait after the last call before executing Defaults to 0ms

Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.