Class Channel<Read, Write>Abstract

Type Parameters

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

cancel: {
    reader: ChannelRelease<Read>;
} = ...

Propagate cancel on all readers

Example

const rChannel = new ReadChannel();

// cancels the "string" channel.
rChannel.cancel.reader.string();

Type declaration

close: {
    writer: ChannelRelease<Write>;
} = ...

Propagate close on all writers of channel

Example

const writer = new WriteChannel();

// closes the "string" channel.
writer.close.writer.string();

Type declaration

Methods

  • Connect the readFrom or writeTo worker/port to either recieve from or send to to a different message port.

    Parameters

    • target: "writeTo" | "readFrom"

      The worker/port to send the connection change to.

    • action: "change-reader" | "change-writer"

      Whether you want to change the "writable" end or the "readable" end of the target

    • connection: MessagePort

      The connection that should now be written to or read from.

    Returns void

  • Ends the communication of the channel. You can always restart the channel with .start().

    Returns void

  • Starts the channel. Called automatically from the constructor, but if you ever .end() the channel this will start it again.

    Returns void

Generated using TypeDoc