Socket
Socket
Sign inDemoInstall

inactivejs

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    inactivejs

Detect when a user is idle or change tabs


Version published
Weekly downloads
72
decreased by-6.49%
Maintainers
1
Install size
276 kB
Created
Weekly downloads
 

Readme

Source

inactivejs

Build Status

Detect when a user is idle. No dependencies, small footprint (2.35kb). Inspired by Idle.js

Usage

Install with npm/yarn:

npm install inactivejs

yarn add inactivejs

Import on your js file:

const InactiveJS = require('inactivejs');

import InactiveJS from 'inactivejs';

Instantiate:

const onAway = () => {
    console.log('user is away');
};

const onBack = () => {
    console.log('user is back');
};

const inactiveInstance = new InactiveJS({
    timeout: 5000,
    onAway: onAway,
    onBack: onBack,
});

Options:

  • timeout (ms): How much time should wait
  • onAway: callback to be executed when the user is away
  • onBack: callback to be executed when the user is back

License

MIT.

FAQs

Last updated on 28 Mar 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc