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

quicktask

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quicktask

Tiny microtask queue scheduler for all environments

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.5K
decreased by-25.04%
Maintainers
1
Weekly downloads
 
Created
Source

Quicktask

Tiny microtask queue scheduler for all environments

npm install --save quicktask

Inspired by yoshuawuyts/nanotask, this function manages a queue of microtasks, but focuses on being cross environment (not just browser) and with a tiny implementation. It returns a "scheduleMicrotask" helper.

  • Uses MutationObserver in the browser, supported by many browsers, including IE11.
  • Uses process.nextTick in Node.js.
  • Uses setTimeout otherwise.

Usage

In JavaScript / Node.js:

const quicktask = require('quicktask').default
const schedule = quicktask()

schedule(function () {
  console.log('resolved at the start of the next frame')
})

In TypeScript:

import quicktask from 'quicktask';
const schedule = quicktask();

schedule(() => {
  console.log('resolved at the start of the next frame');
});

API

const schedule = quicktask()

Create a new Quicktask instance.

schedule(fn)

Queue a function to run before the end of the current event loop.

License

MIT

Keywords

FAQs

Package last updated on 09 Jun 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