@seedalpha/idle
v1.0.11
Published
detect if user is idle
Downloads
3
Readme
idle
check if tab is visible/hidden/active/idle
Installation
$ npm install seed-idle --save
Usage
var idle = require('seed-idle');
idle(3 * 60 * 1000) // set idle threshold to be 3 minutes
.on('inactive', function() {
console.log('user is not doing anything for 3 minutes');
})
.on('active', function() {
console.log('user just became active');
})
.on('hidden', function() {
console.log('tab is on the background');
})
.on('visible', function() {
console.log('table is on the foreground');
})
.on('state', function(state) {
console.log('state is:', state);
// will be one of `active`, `inactive`, `hidden`, `visible`
});
Author
Vladimir Popov [email protected]
License
©2016 SeedAlpha