框架
版本
Debouncer API 参考
Throttler API 参考
速率限制器 API 参考
队列 API 参考
批处理器 API 参考
批处理器示例

DebouncerOptions

接口:DebouncerOptions<TFn>

定义于:debouncer.ts:7

用于配置防抖函数的选项

类型参数

TFn extends AnyFunction

属性

enabled?

ts
optional enabled: boolean | (debouncer) => boolean;
optional enabled: boolean | (debouncer) => boolean;

定义于:debouncer.ts:13

防抖器是否启用。禁用时,maybeExecute 不会触发任何执行。 可以是布尔值或返回布尔值的函数。 默认为 true。


leading?

ts
optional leading: boolean;
optional leading: boolean;

定义于:debouncer.ts:19

是否在超时的前沿执行。 第一次调用将立即执行,其余调用将等待延迟。 默认为 false。


onExecute()?

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

定义于:debouncer.ts:23

函数执行后调用的回调函数

参数

debouncer

Debouncer<TFn>

返回

void


trailing?

ts
optional trailing: boolean;
optional trailing: boolean;

定义于:debouncer.ts:28

是否在超时的后沿执行。 默认为 true。


wait

ts
wait: number | (debouncer) => number;
wait: number | (debouncer) => number;

定义于:debouncer.ts:34

执行函数前的延迟时间(以毫秒为单位)。 可以是数字或返回数字的函数。 默认为 0 毫秒