@ducor/hooks
Version:
A collection of useful React hooks for building modern web applications. Includes hooks for clipboard operations, window events, intervals, timeouts, and more.
19 lines (18 loc) • 656 B
TypeScript
/**
* A robust timeout hook with manual control and auto-invocation options
* @template T - Type of parameters passed to the callback
* @param callback - Function to execute after delay
* @param delay - Delay in milliseconds (null to disable)
* @param options - Configuration options
* @returns Object with control methods
*/
declare function useTimeout<T extends unknown[]>(callback: (...args: T) => void, delay: number | null, options?: {
autoInvoke?: boolean;
autoInvokeParams?: T;
}): {
start: (...args: T) => void;
clear: () => void;
restart: (...args: T) => void;
isActive: () => boolean;
};
export default useTimeout;