@seedalpha/idle

1.0.11 • Public • Published

idle

check if tab is visible/hidden/active/idle

Installation

$ npm install seed-idle --save

Usage

var idle = require('seed-idle');


idle(3 * 60 * 1000) // set idle threshold to be 3 minutes
  .on('inactive', function() {
    console.log('user is not doing anything for 3 minutes');
  })
  .on('active', function() {
    console.log('user just became active');
  })
  .on('hidden', function() {
    console.log('tab is on the background');
  })
  .on('visible', function() {
    console.log('table is on the foreground');
  })
  .on('state', function(state) {
    console.log('state is:', state); 
    // will be one of `active`, `inactive`, `hidden`, `visible`
  });

Author

Vladimir Popov vlad@seedalpha.net

License

©2016 SeedAlpha

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i @seedalpha/idle

    Weekly Downloads

    0

    Version

    1.0.11

    License

    ©2016 SeedAlpha

    Unpacked Size

    4.38 kB

    Total Files

    4

    Last publish

    Collaborators

    • tom.raggett.trcuk.com
    • ac_inc