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

@evandrolg/thequeue

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evandrolg/thequeue

Easy way to queue delayed callbacks.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

thequeue · license

Easy way to queue delayed callbacks. Designed to be used on both client and server-side.

Install

To install thequeue, execute:

$ npm install @evandrolg/thequeue

or

$ yarn add @evandrolg/thequeue

Usage

thequeue was designed to call functions that need to be invoked at a given time (e.g tracking functions that should be performed at a given time for performance reasons). Its api is quite simple, as the example below shows:

import thequeue from 'thequeue';

const q = thequeue();

const fn1 = () => console.log('fn1');
q.register(fn1);

const fn2 = () => console.log('fn2');
q.register(fn2);

const fn3 = () => console.log('fn3');
q.register(fn3);

q.start();
// the functions will be called in the order in which they were added to the queue.

thequeue was also designed with performance in mind and all registered functions are in a Queue that was implemented using a LinkedList. This means that the functions are registered in constant time and are processed (when the start method is invoked) in linear time, without adding any extra space in memory.

TODO

  • Add option to allow a function to be called only when the previous one has finished

Keywords

FAQs

Package last updated on 16 Apr 2021

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