useIdle ​
Hook that defines the logic when the user is idle
typescript
import { useIdle } from '@siberiacancode/reactuse';
Usage ​
typescript
const { idle, lastActive } = useIdle();
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
milliseconds? | number | ONE_MINUTE | The idle time in milliseconds |
options.initialState? | boolean | false | The options for the hook |
options.events? | Array<keyof WindowEventMap> | IDLE_EVENTS |