Propagate cancel on all readers
const rChannel = new ReadChannel();
// cancels the "string" channel.
rChannel.cancel.reader.string();
Propagate close on all writers of channel
const writer = new WriteChannel();
// closes the "string" channel.
writer.close.writer.string();
Readonly
writeWrite to the channel.
An example worker script:
// Setup the channel to be "string" (denoted by the type) with data of type string (denoted by data).
type MyMessage = {type: "string", data: string};
const rwChannel = new ReadWriteChannel<MyMessage, MyMessage>();
// writes to the string channel:
rwChannel.write.string("foo");
Connect the readFrom or writeTo worker/port to either recieve from or send to to a different message port.
The worker/port to send the connection
change to.
Whether you want to change the "writable" end or the "readable" end of the target
The connection that should now be written to or read from.
Generated using TypeDoc
Allows writing to a worker.
Example
An example worker script: