Class AsyncQueue<T>

Queue, which can be used like queue, but also can be polled asynchronously.

Async poling makes receiver/poller wait for somebody to push that element(using append).

It can be closed, effectively flushing the queue. This causes all subscribers to receive an error rather than an element.

Type Parameters

  • T

Hierarchy

  • AsyncQueue

Implements

Constructors

Properties

awaitersQueue: DefaultQueue<{
    reject: ((e) => void);
    resolve: ((value) => void);
}> = ...

Type declaration

  • reject: ((e) => void)
      • (e): void
      • Parameters

        • e: any

        Returns void

  • resolve: ((value) => void)
      • (value): void
      • Parameters

        • value: T

        Returns void

closeError: Error = ...
isClosed: boolean = false
resultQueue: DefaultQueue<T> = ...

Accessors

  • get length(): number
  • Returns how many elements are in queue, rather than how many awaiters are there.

    Returns number

  • get oldLength(): number
  • Negative, when more people are waiting than there is messages. Positive if there are messages waiting to be received. Zero if empty and nobody's waiting.

    Returns number

    Deprecated

    previously it was called length, but now this queue implements Queue interface.

Methods

  • Parameters

    • value: T

    Returns void

    Deprecated

    Used only for compatibility with Queue. Use append instead.

Generated using TypeDoc