pool-queue

A promise-based data structure which allows tasks to be performed concurrently and resolved serially.


License
MIT
Install
npm install pool-queue@2.0.2

Documentation

Hierarchy

PoolQueue

Index

Constructors

Methods


Constructors

constructor

⊕ new PoolQueue(concurrency: number): PoolQueue

Defined in index.ts:8

Parameters:

Param Type
concurrency number

Returns: PoolQueue


Methods

drain

â–¸ drain(): Promise<void>

Defined in index.ts:38

Wait until the queue has no more work to complete.

Returns: Promise<void>


poll

â–¸ poll(): Promise<void>

Defined in index.ts:31

Wait until the queue has at least one free worker.

Returns: Promise<void>


submit

â–¸ submitT(work: function): Promise<T>

Defined in index.ts:18

Submit a task to be completed

Type parameters:

T

Parameters:

Param Type
work function

Returns: Promise<T> a Promise containing the completed work. While the task is executed concurrently, the returned Promise is fulfilled serially in the order it was submitted.