Yielded value type.
Return value type.
Error type (default: unknown).
Returns a promise that resolves with the channel's return value, or rejects with its error. Repeated calls return the same promise without consuming buffered events.
Subscribes to all events (yield, return, and throw) as they arrive.
Immediately flushes any already-buffered events to callback, then
continues to deliver new events in order.
Callbacks run synchronously and are not awaited. A throwing callback is
detached: during replay its exception propagates from this call; for new
events, all pending consumers are notified before the producer receives
the first callback exception. Channel completion and errors are unaffected.
Read-side of an async channel that consumes values via iteration or callbacks.
Implements
AsyncIterable, so it can be consumed withfor await...of. Each iterator returned by[Symbol.asyncIterator]()replays from the beginning of the buffered events independently.See
Example