Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including idle-tracker with all npm packages installed. Try it out:

var idleTracker = require("idle-tracker")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

idle-tracker v0.0.6

Pure Javascript library to track browser inactivity

Idle Tracker

idle tracker
npm gzip size downloads circleci Greenkeeper badge

Javascript library to track browser idle status. (callback when user is idle).

Demo

Installation

via yarn

$ yarn add idle-tracker

or via npm

$ npm install idle-tracker

Usage

import IdleTracker from 'idle-tracker';

const idleTracker = new IdleTracker(options);

idleTracker.start(); // start tracker

idleTracker.end(); // stop tracker and release memory

Constructor options

Options NameTypeDefaultDescription
timeout (ms)number30000timeout to count as idle
onIdleCallbackFunctionnoopFunction to be called when idle status change, payload will be { idle: true/false }
throttlenumber500throttle rate of callback

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free