frame-msg
    Preparing search index...

    Class AsyncQueue<T>

    A simple Promise-based queue used by the Rx classes to manage asynchronous operations. This queue allows for putting and getting values in a FIFO manner, handling asynchronous operations without blocking the main thread.

    Type Parameters

    • T
    Index

    Constructors

    Methods

    Constructors

    • Constructs a new AsyncQueue instance. Initializes an empty queue for storing promises and their resolvers.

      Type Parameters

      • T

      Returns AsyncQueue<T>

    Methods

    • Clears all items from the queue. This removes all pending promises and their resolvers. Note: This does not explicitly reject pending promises from get() calls, so consumers awaiting get() might remain pending indefinitely if not handled.

      Returns void

    • Retrieves a value from the front of the queue. If the queue is empty, this method waits until a value is added.

      Returns Promise<T>

      A Promise that resolves with the value from the front of the queue.

    • Checks if the queue is currently empty. This checks if there are any resolved or pending promises in the queue.

      Returns boolean

      True if the queue is empty, false otherwise.

    • Adds a value to the end of the queue. If there are pending get operations, this will resolve the oldest one. Otherwise, the value is stored until a get operation is called.

      Parameters

      • value: T

        The value to add to the queue.

      Returns void

    • Gets the current number of items in the queue. This represents the number of promises (resolved or pending) currently held by the queue.

      Returns number

      The number of items in the queue.