@lesnoypudge/utils-react
Version:
lesnoypudge's utils-react
22 lines (21 loc) • 724 B
TypeScript
import { T } from '@lesnoypudge/types-utils-base/namespace';
export declare namespace useThrottle {
type Options = {
/**
* Disable state updating.
* Ref will keep updating.
*
* @default false
*/
stateless?: boolean;
};
}
/**
* Controls the rate at which a function can be called, limiting it to a
* certain frequency, while tracking the throttling state.
*/
export declare const useThrottle: (options?: useThrottle.Options) => {
isThrottling: boolean;
isThrottlingRef: import('react').MutableRefObject<boolean>;
throttle: <_Callback extends T.AnyFunction>(callback: _Callback, delay: number) => (...args: Parameters<_Callback>) => void;
};