user-idle-tracker

1.0.2 • Public • Published

User Idle Tracker

User inactive for a while and then the modal appears

A library to check the status of the user and to run a callback when its considered Idle.

Netflix: Are you still there? Me: an image of a fat and tired dog

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:

import UserIdleTracker from "user-idle-tracker";

And now you can use it like:

function callback() {
  console.log("A function to be called when user is considered idle");
}
 
const idleTime = 1000; // time in milliseconds defined to be considered idle
 
const tracker = new UserIdleTracker(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.

Dependencies (0)

    Dev Dependencies (17)

    Package Sidebar

    Install

    npm i user-idle-tracker

    Weekly Downloads

    57

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    426 kB

    Total Files

    15

    Last publish

    Collaborators

    • willianjusten