A utility function for creating a page-idling handler
npm install idle-handlerA simple, dependency-free implementation of a window-idle checker.
#### NPM
Library can be installed via NPM using the following command:
```
$ npm install --save idle-handler
#### Browser
Download a copy of idlehandler.bundle.js from the dist/ folder.
#### NPM
`
import { createIdleHandler } from 'idle-handler';
var handler = createIdleHandler(timeoutInMinutes, function () {
alert('you have timed out');
});
window.onload = handler;
`
#### Browser
Add the distribution javascript file to your HTML page
``
Now use the createIdleHandler() function on the idleHandler object to createwindow.onload
your handler function and assign it as the callback for .
`
var timeoutInMinutes = 5;
var handler = idleHandler.createIdleHandler(timeoutInMinutes, function () {
alert('you have timed out');
});
window.onload = handler;
`
###### createIdleHandler(timeout: Number, callback: Function): Function
- timeout represents the amount of time in minutes before callback is called.callback
- is the function that will be called if there is no interaction with
the browser for the period of time specified by 1timeout
Note: timeout is the amount of time in whole minutes, so prepare accordingly.
This software is licensed under the MIT license. Refer to LICENSE` for
more information.