Socket
Socket
Sign inDemoInstall

inactivity-timer

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    inactivity-timer

Run a function after a period of inactivity.


Version published
Weekly downloads
280
decreased by-10.26%
Maintainers
1
Install size
10.7 kB
Created
Weekly downloads
 

Readme

Source

Inactivity Timer

Run a function after a period of inactivity.

Installation

npm install --save inactivity-timer

Usage

const createInactivityTimer = require('inactivity-timer')

// Lock the screen after 5 min of idle
const lockTimer = createInactivityTimer('5m', () => {
  // Lock the screen!
})

// Signal activity when the mouse moves
document.addEventListener('mousemove', () => {
  lockTimer.signal()
})

API

createInactivityTimer(threshold, onInactivity) => InactivityTimer

Create a new InactivityTimer.

threshold can be specied as either a number, in milliseconds, or any string that the ms module can parse.

InactivityTimer#clear()

Clear any timer currently scheduled.

InactivityTimer#signal()

Signal activity, which will extend the time until onInactivity is called with the earlier specified threshold.

Keywords

FAQs

Last updated on 07 Feb 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