Type parameters
| Name |
|---|
T |
Methods#
close#
â–¸ close(): void
Flushes the channel before notifying the consumer that the channel is
closed (notification comes in the form of the async iterator returning).
Further calls to e.g. send will throw a ChannelClosedError.
Returns: void
Defined in: channels/channel_interfaces.ts:23
fail#
â–¸ fail(error: Error): void
Behaves exactly like close, except throws an error in the consumer once the channel is flushed.
Parameters:#
| Name | Type |
|---|---|
error | Error |
Returns: void
Defined in: channels/channel_interfaces.ts:37
open#
â–¸ open(): void
Opens the channel. This is implicitly called at the start of send,
close and fail as well, but can be called explicitly without having to
write the channel.
Returns: void
Defined in: channels/channel_interfaces.ts:11
send#
â–¸ send(value: T): void
Sends data over the channel (buffering if the reader is busy).
Parameters:#
| Name | Type |
|---|---|
value | T |
Returns: void
Defined in: channels/channel_interfaces.ts:16
sendAndClose#
â–¸ sendAndClose(value: T): void
A combination of send and close, but in one atomic operations. This is
useful for queuing a message and immediately closing it, so that the events
can be combined on the receiving end by checking isDone while consuming
messages.
Parameters:#
| Name | Type |
|---|---|
value | T |
Returns: void
Defined in: channels/channel_interfaces.ts:31