Options
All
  • Public
  • Public/Protected
  • All
Menu

FIFO queue for Promises. Supports pushing single elements onto the queue and settling one or all elements in the queue. Implemented using List.

Type parameters

  • T

Hierarchy

  • PromiseQueue

Index

Constructors

constructor

Methods

push

  • push(): Promise<T>
  • Time complexity: O(1)

    Returns Promise<T>

    A Promise that will be settled when its turn comes and #resolveOne or #rejectOne is called, or when #resolveAll or #rejectAll are called.

rejectAll

  • rejectAll(reason?: any): number
  • Time complexity: O(n), where n is the number of unsettled Promises in the queue.

    Parameters

    • Optional reason: any

      The reason to reject queued Promises with.

    Returns number

    The number of settled Promises.

rejectOne

  • rejectOne(reason?: any): boolean
  • Time complexity: O(1)

    Parameters

    • Optional reason: any

      The reason to reject a queued Promise with.

    Returns boolean

    True if a Promise was dequeued and rejected.

resolveAll

  • resolveAll(value: T | PromiseLike<T>): number
  • Time complexity: O(n), where n is the number of unsettled Promises in the queue.

    Parameters

    • value: T | PromiseLike<T>

      The value to resolve queued Promises with.

    Returns number

    The number of settled Promises.

resolveOne

  • resolveOne(value: T | PromiseLike<T>): boolean
  • Time complexity: O(1)

    Parameters

    • value: T | PromiseLike<T>

      The value to resolve a queued Promise with.

    Returns boolean

    True if a Promise was dequeued and resolved.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc