User Idle Tracker
A library to check the status of the user and to run a callback when its considered Idle.
Installing
Install the library via npm install user-idle-tracker
or yarn add user-idle-tracker
. Or you can even download the file here and load with the good and old way <script src="user-idle-tracker.min.js"></script>
.
How to use
If you used npm/yarn, just import the file:
;
And now you can use it like:
{ console;} const idleTime = 1000; // time in milliseconds defined to be considered idle const tracker = callback idleTime;
Testing
You can see the tests on index.test.js, use yarn test
to run the tests. If you want to see an example working on the Browser, just run yarn start
.