The producer half of StreamClass.channel: emit into it, consume stream out of it.
const channel: Channel<string> = Stream.channel<string>(); channel.emit('a'); // true — buffered, room to spare channel.buffered; // 1
Offers a value. Returns false when there is no room left — Node's write() convention:
advisory for a producer that can slow down, ignorable for one that cannot.
close(): void
Ends the stream once the buffer drains. Idempotent.
abort(reason: unknown): void
Rejects the consuming Task with reason — the two-tier rule's bug tier. Idempotent.
ready(): Promise<void>
Resolves once there is room to emit again — Web Streams' writer.ready, and the promise
form of Node's 'drain'.
Named for the condition it actually reports. It resolves when the buffer is below
capacity, not when it is empty: with 9 of 10 buffered it resolves immediately, because
there is room for a tenth. "Drained" would claim the opposite. It is also awaited in a loop
rather than once, so it names a recurring gate, unlike the genuinely final closed.