is-idle
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Is idle

General purpose idle detection. Timeout based.

Installation

 $ npm i is-idle

Usage

import isIdle from "is-idle"

// setup
const isScrollIdle = isIdle()
document.body.addEventListener("scroll", () => {
  isScrollIdle.stillActive()
})

// use
isScrollIdle.get((isIdle) => {
  if (isIdle) console.log("Is idle")
  else console.log("Is not idle")
})

Uses josm Data (as return value) for subscription handeling. For advanced usage read respective doc.

Contribute

All feedback is appreciated. Create a pull request or write an issue.

Package Sidebar

Install

npm i is-idle

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

4.83 kB

Total Files

8

Last publish

Collaborators

  • zzrv