Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

away

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

away

detect when a user is idle on a page

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
278
decreased by-25.27%
Maintainers
1
Weekly downloads
 
Created
Source

away

detect idle users on webpages

browser support

var away = require('away');

// detect users who are idle for 10 seconds
var timer = away(10000);
timer.on('idle', function() {
    console.log('user is idle');
});
timer.on('active', function() {
    console.log('user is active');
});

api

away() returns a Timer object which exposes the following methods.

.on('idle', fn)

Call fn when user becomes idle.

.on('active', fn)

Call fn when user becomes active after having been idle.

.stop()

Stop the idle timer from detecting user activity

.start()

Start the idle timer. (By default the idle timer is started automatically)

options

idle() accepts a second argument with additional options.

element

The dom element to monitor for activity. (default document)

timeout

Milliseconds before user is considered idle. (default 30000)

events

String of DOM events that will trigger activity. (see index.js for default)

start

Whether to start idle timer upon creation. (default true)

install

npm isnstall away

credits

Inspired by the jquery-idletimer plugin.

Keywords

FAQs

Package last updated on 05 Mar 2013

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc