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

nanoscheduler

Package Overview
Dependencies
Maintainers
24
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanoscheduler

Schedule work to be completed when the browser is idle.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
97K
increased by34.58%
Maintainers
24
Weekly downloads
 
Created
Source

nanoscheduler

npm version build status downloads js-standard-style

Schedule work to be completed when the user agent is idle. Weighs 270 bytes compressed.

Usage

var NanoScheduler = require('nanoscheduler')

var scheduler = NanoScheduler()
var i = 10000
while (i--) scheduler.push(() => console.log(`idle time! ${Date.now()}`))

Why?

Just like with window.requestAnimationFrame, it's much more efficient to share a single instance than to call it for each piece of work. There's a significant overhead when scheduling small amounts of work. This package allows sharing a scheduler as a singleton, which makes it particularly useful to be shared between multiple applications.

API

scheduler = NanoScheduler()

Create a new scheduler instance. The instance is shared as a singleton on window (if available).

scheduler.push(cb)

Push a callback into the scheduler, to be executed when the user agent is idle.

Installation

$ npm install nanoscheduler

License

Apache-2.0

Keywords

FAQs

Package last updated on 23 Mar 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