Skip to main content

interface CrossChannel.Constructors

Defines the static CrossChannel API.

Methods

combine

Returns a CrossChannel where the send module comprises the given 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

NameDefaultDescription
TSendvoidthe send message type
TReceiveTSendthe receive message type

Parameters

NameTypeDescription
writeChChannel.Write<TSend>the write channel to use for sending messages
readChChannel.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.

Definition

createPair<TSend = void, TReceive = TSend>(config?: CrossChannel.Config): CrossChannel.Pair<TSend, TReceive>;

Type parameters

NameDefaultDescription
TSendvoidthe send message type
TReceiveTSendthe receive message type

Parameters

NameTypeDescription
configCrossChannel.Config