@linkorb/idle
v0.1.1
Published
A simple javascript library to detect browser idle and perform actions.
Readme
idle.js
A simple javascript library to detect browser idle and perform actions.
Installation
npm install @linkorb/idleDemo
Check the demo/ directory for an demonstration + example on how to use idle.js
How to use
To support idle.js in your application, you'll need to include a script tag in your html:
<script type="text/javascript" src="../idle.js"></script>You may specify some global variables to tweak the behaviors.
// set redirect url (relative) after idle timeout
_idle('url', '/demo/logout.html');
// set escaped urls that no need to detect idle, e.g. logout page
_idle('escape', ['/demo/logout.html']);
// specifying a callback to replace the default redirect action
_idle('callback', function(){console.log('timeout')});
// customize idle time interval, in ms.
_idle('interval', 2000);
// enable debug mode
_idle('debug', true);Build from source
To change the source file and build, simply use webpack.
# generates dist/tweak.js
webpack -d
# generates dist/tweak.min.js
webpack -pLicense
MIT (see LICENSE)
Brought to you by the LinkORB Engineering team
Check out our other projects at linkorb.com/engineering.
Btw, we're hiring!
