thequeue ·
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();
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