UNPKG

@better-typed/react-performance-hooks

Version:
24 lines (21 loc) 901 B
declare type DebounceFunctionType = (callback: () => void | Promise<void>, dynamicDelay?: number) => void; declare type UseDebounceReturnType = { debounce: DebounceFunctionType; reset: VoidFunction; active: boolean; }; /** * @param delay * @internal * @returns */ declare const useDebounce: (delay?: number) => UseDebounceReturnType; declare type ThrottleFunctionType = (callback: () => void | Promise<void>, dynamicDelay?: number) => void; declare type UseThrottleReturnType = { throttle: ThrottleFunctionType; reset: VoidFunction; active: boolean; }; declare type ThrottleFunction = (callback: () => void | Promise<void>, dynamicDelay?: number) => void; declare const useThrottle: (delay?: number) => UseThrottleReturnType; export { DebounceFunctionType, ThrottleFunction, ThrottleFunctionType, UseDebounceReturnType, UseThrottleReturnType, useDebounce, useThrottle };