Socket
Socket
Sign inDemoInstall

on-idle

Package Overview
Dependencies
1
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    on-idle

Detect when the browser is idle


Version published
Weekly downloads
737
decreased by-34.14%
Maintainers
2
Install size
89.4 kB
Created
Weekly downloads
 

Readme

Source

on-idle stability

npm version build status downloads js-standard-style

Safely detect when the browser is idle. Does nothing when run in Node.

on idle console screenshot

Usage

var onIdle = require('on-idle')
var html = require('bel')

var cancel = onIdle(function () {
  var el = html`<h1>browser is idle</h1>`
  document.body.appendChild(el)
})

if (somethingHappens) {
  cancel()
}

API

onIdle(callback, options)

Call a function when the browser has spare time. Calls it on the next frame if window.requestIdleCallback is not available. Does nothing in Node.

License

MIT

Keywords

FAQs

Last updated on 17 Oct 2017

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