interface Channel.Write<T>
A write-only Channel that can perform blocking writes. This means that a send
call will block until the channel has capacity to send a message.
Implemented by: CrossChannel<TSend,TReceive>
, Channel<T>
Type parameters
Name | Default | Description |
---|---|---|
T | void | the channel message type |
Properties
Methods
send
Send the given value
message to the Channel. Blocks if the Channel is already at maximum capacity.
send
value
message to the Channel. Blocks if the Channel is already at maximum capacity.Definitions
send(value: T, options: {
signal?: AbortSignal
|
undefined;
timeoutMs?: number
|
undefined;
catchChannelErrors?: false
|
undefined;
}): Promise<void>;
send(value: T, options?: {
signal?: AbortSignal
|
undefined;
timeoutMs?: number
|
undefined;
catchChannelErrors: boolean;
}): Promise<undefined
|
Channel.Error
>;
Parameters
Name | Type | Description |
---|---|---|
value | T | the message to send to the channel |
options | { signal?: AbortSignal | undefined; timeoutMs?: number | undefined; catchChannelErrors?: false | undefined; } | (optional) the message send options - signal: (optional) an abort signal to cancel sending - timeoutMs: (optional) amount of milliseconds to wait for being able to send message - recover: (optional) a function that can be supplied to recover from a channel error |
sendAll
Sequentially send all the values in the given source
to the channel. Blocks until all the values are sent.
sendAll
source
to the channel. Blocks until all the values are sent.Definitions
sendAll(source:
AsyncStreamSource
<T>, options: {
signal?: AbortSignal
|
undefined;
timeoutMs?: number
|
undefined;
catchChannelErrors?: false
|
undefined;
}): Promise<void>;
sendAll(source:
AsyncStreamSource
<T>, options?: {
signal?: AbortSignal
|
undefined;
timeoutMs?: number
|
undefined;
catchChannelErrors: boolean;
}): Promise<undefined
|
Channel.Error
>;
Parameters
Name | Type | Description |
---|---|---|
source | AsyncStreamSource <T> | a stream source containing the values to send |
options | { signal?: AbortSignal | undefined; timeoutMs?: number | undefined; catchChannelErrors?: false | undefined; } | the message send options - signal: (optional) an abort signal to cancel sending - timeoutMs: (optional) amount of milliseconds to wait for being able to send message, for each separate message in the source - recover: (optional) a function that can be supplied to recover from a channel error |
writable
Returns the Channel as a write-only Channel.Write instance.
writable
Definition
writable():
Channel.Write
<T>;