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

DebouncerOptions

Interface: DebouncerOptions<TFn>

Defined in: debouncer.ts:6

Options for configuring a debounced function

Type Parameters

TFn extends AnyFunction

Properties

enabled?

ts
optional enabled: boolean;
optional enabled: boolean;

Defined in: 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: debouncer.ts:17

Whether to execute on the leading edge of the timeout. The first call will execute immediately and the rest will wait the delay. Defaults to false.


onExecute()?

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

Defined in: debouncer.ts:21

Callback function that is called after the function is executed

Parameters

debouncer

Debouncer<TFn>

Returns

void


trailing?

ts
optional trailing: boolean;
optional trailing: boolean;

Defined in: debouncer.ts:26

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


wait

ts
wait: number;
wait: number;

Defined in: debouncer.ts:31

Delay in milliseconds before executing the function 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.