定义于: debouncer.ts:49
用于配置防抖函数的选项
• TFn extends AnyFunction
optional enabled: boolean | (debouncer) => boolean;
optional enabled: boolean | (debouncer) => boolean;
定义于: debouncer.ts:55
防抖器是否启用。当禁用时,maybeExecute 不会触发任何执行。可以是布尔值或返回布尔值的函数。默认为 true。
optional initialState: Partial<DebouncerState<TFn>>;
optional initialState: Partial<DebouncerState<TFn>>;
定义于: debouncer.ts:59
防抖器的初始状态
optional key: string;
optional key: string;
定义于: debouncer.ts:64
用于标识防抖器的键。如果提供,防抖器将在开发者工具和 PacerProvider(如果适用)中以此键标识。
optional leading: boolean;
optional leading: boolean;
定义于: debouncer.ts:70
是否在超时前沿执行。第一次调用将立即执行,其余的将等待延迟。默认为 false。
optional onExecute: (args, debouncer) => void;
optional onExecute: (args, debouncer) => void;
定义于: debouncer.ts:74
函数执行后调用的回调函数
Parameters<TFn>
Debouncer<TFn>
void
optional trailing: boolean;
optional trailing: boolean;
定义于: debouncer.ts:79
是否在超时后沿执行。默认为 true。
wait: number | (debouncer) => number;
wait: number | (debouncer) => number;
定义于: debouncer.ts:85
执行函数前的延迟(毫秒)。可以是数字或返回数字的函数。默认为 0 毫秒。
您的每周 JavaScript 资讯。每周一免费发送给超过 10 万开发者。