🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

idle-detect

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
I

idle-detect

A TypeScript library for inactivity timer, which utilises `IdleDetector` API where possible or a fallback to `window.setTimeout` approach

0.2.0
latest
73

Supply Chain Security

100

Vulnerability

73

Quality

76

Maintenance

100

License

Version published
Maintainers
2
Created
Issues
0

Idle Detect

A TypeScript library for inactivity timer, which utilises IdleDetector API where possible or a fallback to window.setTimeout approach.

Usage

npm install idle-detect
import IdleDetect from 'idle-detect'
// Or, if you don't want to use still experimental IdleDetector API:
// import { IdleDetect } from 'idle-detect/dist/IdleDetect'

const onInactive = () => {
  console.info('User is inactive now')
}
const idleDetect = new IdleDetect(15 * 60, onInactive)

// Start timer, e.g. when user is logged in
idleDetect.start()

// End timer, e.g. when user is logged out
idleDetect.cleanupAndStop()

FAQs

Package last updated on 14 Nov 2022

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