Interface WriteChannel<T>

a write-only channel

Type Parameters

  • T

Hierarchy

Implemented by

Properties

capacity: number

Returns how much data the channel has buffered

isClosed: boolean

Returns whether the channel is closed

length: number

Returns the channel buffer size

Methods

  • Close the channel, after which the channel will not be able to write, all blocked reads and writes are returned, but the value that has been written to the channel is guaranteed to be fully read

    Returns

    Returns false if the channel has been closed, otherwise closes the channel and returns true

    Returns boolean

  • Attempt to write a value to the channel

    Returns

    Returns true if the write is successful

    Throws

    ChannelException Writing a value to a closed channel will throw errChannelClosed

    Parameters

    • val: T

      value to write

    • Optional exception: boolean

      If set to true, writing to a closed channel will throw an exception

    Returns boolean

  • Writes a value to the channel, blocking if the channel is not writable until the channel is writable or closed

    Returns

    Returns true if the write is successful, false otherwise this is usually because the channel has been closed

    Throws

    ChannelException Writing a value to a closed channel will throw errChannelClosed

    Parameters

    • val: T

      value to write

    • Optional exception: boolean

      If set to true, writing to a closed channel will throw an exception

    Returns boolean | Promise<boolean>

  • Create a case for select to write to

    Throws

    ChannelException Writing a value to a closed channel, select will throw errChannelClosed

    Parameters

    • val: T

      value to write

    • Optional exception: boolean

      If set to true, writing to a closed channel will throw an exception

    Returns WriteCase<T>

Generated using TypeDoc