定义于: throttler.ts:54
用于配置节流函数的选项
• TFn extends AnyFunction
optional enabled: boolean | (throttler) => boolean;
optional enabled: boolean | (throttler) => boolean;
定义于: throttler.ts:60
节流器是否启用。禁用时,maybeExecute 将不会触发任何执行。可以是布尔值或返回布尔值的函数。默认为 true。
optional initialState: Partial<ThrottlerState<TFn>>;
optional initialState: Partial<ThrottlerState<TFn>>;
定义于: throttler.ts:64
节流器的初始状态
optional key: string;
optional key: string;
定义于: throttler.ts:69
用于标识节流器的键。如果提供,节流器将在开发者工具和 PacerProvider (如果适用) 中由此键标识。
optional leading: boolean;
optional leading: boolean;
定义于: throttler.ts:74
是否在超时前沿执行。默认为 true。
optional onExecute: (args, throttler) => void;
optional onExecute: (args, throttler) => void;
定义于: throttler.ts:78
函数执行后调用的回调函数
Parameters<TFn>
Throttler<TFn>
void
optional trailing: boolean;
optional trailing: boolean;
定义于: throttler.ts:83
是否在超时后沿执行。默认为 true。
wait: number | (throttler) => number;
wait: number | (throttler) => number;
定义于: throttler.ts:89
函数执行的时间窗口(毫秒),在此期间函数只能执行一次。可以是数字或返回数字的函数。默认为 0 毫秒。
您的每周 JavaScript 资讯。每周一免费发送给超过 10 万开发者。