detect when a user is idle on a page
detect idle users on webpages
var away = require'away';// detect users who are idle for 10 secondsvar timer = away10000;timeron'idle'console.log'user is idle';;timeron'active'console.log'user is active';;
away() returns a Timer object which exposes the following methods.
fn when user becomes idle.
fn when user becomes active after having been idle.
Stop the idle timer from detecting user activity
Start the idle timer. (By default the idle timer is started automatically)
idle() accepts a second argument with additional options.
The dom element to monitor for activity. (default
Milliseconds before user is considered idle. (default
String of DOM events that will trigger activity. (see index.js for default)
Whether to start idle timer upon creation. (default
npm isnstall away
Inspired by the jquery-idletimer plugin.