UNPKG

common-hook

Version:
20 lines (19 loc) 463 B
type noop = (...args: any) => any; /** * @name 处理函数节流的Hook * @description * 规定在时间内,只能触发一次函数。如果这个时间内触发多次函数,只有一次生效 * @example * const { run } = useThrottleFn( () => { setValue(value + 1); }, { wait: 500 }, ); */ export declare const useThrottleFn: <T extends noop>(fn: T, options?: any) => { run: any; cancel: any; flush: any; }; export {};