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

ThrottlerOptions

接口:ThrottlerOptions<TFn>

定义于:throttler.ts:7

用于配置节流函数的选项

类型参数

TFn extends AnyFunction

属性

enabled?

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

定义于:throttler.ts:13

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


leading?

ts
optional leading: boolean;
optional leading: boolean;

定义于:throttler.ts:18

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


onExecute()?

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

定义于:throttler.ts:22

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

参数

throttler

Throttler<TFn>

返回

void


trailing?

ts
optional trailing: boolean;
optional trailing: boolean;

定义于:throttler.ts:27

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


wait

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

定义于:throttler.ts:33

函数只能执行一次的时间窗口(以毫秒为单���)。 可以是数字或返回数字的函数。 默认为 0 毫秒