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

inactivity-timer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inactivity-timer

Run a function after a period of inactivity.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
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

Package last updated on 07 Feb 2018

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