namespace CrossChannel
A CrossChannel is a channel of which the send and receive modules are not internally connected. This means that the send and receive message types can also differ. A normal Channel can receive its own message, but a CrossChannel cannot, and so they are usually created in pairs to perform bidirectional communication with some other entity.
Companion interface: CrossChannel<TSend,TReceive>
Interfaces
Name | Description |
---|---|
CrossChannel.Config | Configuration options for creating a CrossChannel |
CrossChannel.Constructors | Defines the static CrossChannel API. |
Static Methods
combine
Returns a CrossChannel where the send module comprises the given writeCh
, and the receive module conists of the given readCh
.
combine
writeCh
, and the receive module conists of the given readCh
.Definition
combine<TSend = void, TReceive = TSend>(writeCh:
Channel.Write
<TSend>, readCh:
Channel.Read
<TReceive>):
CrossChannel
<TSend, TReceive>;
Type parameters
Name | Default | Description |
---|---|---|
TSend | void | the send message type |
TReceive | TSend | the receive message type |
Parameters
Name | Type | Description |
---|---|---|
writeCh | Channel.Write <TSend> | the write channel to use for sending messages |
readCh | Channel.Read <TReceive> | the read channel to use for receiving messages |
createPair
Returns a pair of connected CrossChannels of which the send module of the first is connected to the receive module of the second, and the send module of the second is connected to the receive module of the first.
createPair
Definition
createPair<TSend = void, TReceive = TSend>(config?:
CrossChannel.Config
):
CrossChannel.Pair
<TSend, TReceive>;
Type parameters
Name | Default | Description |
---|---|---|
TSend | void | the send message type |
TReceive | TSend | the receive message type |
Parameters
Name | Type | Description |
---|---|---|
config | CrossChannel.Config |