@thibault.sh/hooks
Version:
A comprehensive collection of React hooks for browser storage, UI interactions, and more
17 lines (15 loc) • 514 B
TypeScript
interface TimerControls {
start: () => void;
pause: () => void;
reset: () => void;
isRunning: boolean;
}
/**
* Hook that provides a timer with controls
* @param initialTime - Initial time in seconds
* @param step - Time step in seconds (default: 1)
* @param countDown - Whether to count down instead of up (default: false)
* @returns [currentTime, controls]
*/
declare function useTimer(initialTime: number, step?: number, countDown?: boolean): [number, TimerControls];
export { useTimer };