Skip to content

useIdle ​

sensors
test coverage
Last changed: last month

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

NameTypeDefaultNote
milliseconds?numberONE_MINUTEThe idle time in milliseconds
options.initialState?booleanfalseThe options for the hook
options.events?Array<keyof WindowEventMap>IDLE_EVENTS

Source ​

Source • Demo

Contributors ​

Avatardebabin
Avatarhywax

Released under the MIT License.