promise-priority-queue
v6.0.4
Published
A promisified bucket priority queue written in Typescript with no external dependencies.
Downloads
7
Maintainers
Readme
Promise Priority Queue
A promisified bucket priority queue written in Typescript with no external dependencies.
Requirements
node >= 5.0
Installation
npm i -S promise-priority-queue
Usage
import PromiseQueue from 'promise-priority-queue';
const concurrency = 10;
const queue = new PromiseQueue({ concurrency /** optional */ });
const priority = 1;
const task = async (): number => {
// do work
return 1;
};
const result: number = await queue.addTask( priority, task ); // resolves with the task result
API
Documentation is available here
Deep link to the PromiseQueue class