https://github.com/prolincur/react-idle-interval
Utility to periodically call a callback function and skip when user is idle.
https://github.com/prolincur/react-idle-interval
Last synced: 2 months ago
JSON representation
Utility to periodically call a callback function and skip when user is idle.
- Host: GitHub
- URL: https://github.com/prolincur/react-idle-interval
- Owner: prolincur
- License: apache-2.0
- Created: 2024-02-26T11:53:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-26T11:57:50.000Z (over 1 year ago)
- Last Synced: 2024-04-27T02:43:31.863Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/react-idle-interval
- Size: 223 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-idle-interval
Utility to periodically call a callback function and skip when user is idle.#### Install
`yarn add react-idle-interval`#### Usage
```javascript
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'),
})}
```
### Author
[Prolincur Technologies](https://prolincur.com)