ADK for TypeScript: API Reference
    Preparing search index...

    Class AsyncQueue<T>

    A generic, single-consumer async queue that implements AsyncIterable, bridging a push producer to a pull consumer (for await (const x of q)).

    Producers call push as values are produced and close (or fail) when finished. A single consumer drains the queue.

    Semantics:

    • Buffered items are always delivered before an end/error signal.
    • close ends iteration cleanly (done: true); idempotent.
    • fail surfaces the error to the consumer after any buffered items have been drained; it is sticky (first failure wins) and also closes the queue, so a later close() can't discard the error.
    • push after close/fail is ignored (the producer has already signalled completion).

    Type Parameters

    • T

    Implements

    • AsyncIterable<T>

    Constructors

    Accessors

    Methods

    • Signals that no more items will be produced. Any awaiting consumer receives {done: true}. Idempotent.

      Returns void

    • Signals that production failed. Buffered items are still delivered first; once the buffer drains, the consumer's next next() rejects with error. Sticky (first failure wins) and closes the queue.

      Parameters

      • error: unknown

      Returns void

    • Enqueues a value. If a consumer is currently awaiting, it is resolved immediately; otherwise the value is buffered. No-op once closed/failed.

      Parameters

      • value: T

      Returns void