@quanxi/ui
Version:
全悉组件库
13 lines (12 loc) • 324 B
TypeScript
interface ThrottleOptions {
wait?: number;
leading?: boolean;
trailing?: boolean;
}
type Fn = (...args: any) => any;
declare function useThrottleFn<T extends Fn>(fn: T, options?: ThrottleOptions): {
run: T;
cancel: () => void;
flush: () => ReturnType<T> | undefined;
};
export default useThrottleFn;