idle-js
npm install idle-js --save
Usage
var idle = new IdleJs({
idle: 10000,
events: ['mousemove', 'keydown', 'mousedown', 'touchstart'],
onIdle: function () {},
onActive: function () {},
onHide: function () {},
onShow: function () {},
keepTracking: true,
startAtIdle: false
});
idle.start();
idle.stop()
.reset()
.start();
idle.reset({
idle: false,
visible: ! document.hidden,
})
Running examples
Webpack:
- Run the command
npx webpack ./example/webpack/entry.js ./example/webpack/bundle.js
. - Open
./example/webpack/index.html
in your browser.
In browser:
- Open
./example/vanilla/index.html