A queue that processes promises with a given concurrency and delays after each promise if desired.

Constructors

Methods

Constructors

  • Parameters

    • Optionalconcurrency: number
    • Optionaldelay: number

    Returns PromiseQueue

Methods

  • Add a promise to the queue. It returns a promise that can be awaited.

    Type Parameters

    • T

    Parameters

    • executor: (() => Promise<T>)
        • (): Promise<T>
        • Returns Promise<T>

    Returns Promise<T>

  • Clear the queue.

    Parameters

    • reject: boolean

    Returns void

  • Close the queue and remove all outstanding promises (but do not reject them).

    Returns void