react-idle-interval
v1.0.0
Published
Utility to periodically call a callback function and skip when user is idle.
Downloads
13
Maintainers
Readme
react-idle-interval
Utility to periodically call a callback function and skip when user is idle.
Install
yarn add react-idle-interval
Usage
import { useIdleInterval, useInterval } from 'react-idle-interval'
function MyComponent () {
useIdleInterval({
callback: () => console.log('callback called'),
interval: 100, // ms
idleTimer: 1000, // ms
onIdle: () => console.log('called on idle'),
onActive: () => console.log('called on active'),
})
}