Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 796 Bytes

README.md

File metadata and controls

37 lines (23 loc) · 796 Bytes

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

Deep link to the PromiseQueue class