Skip to main content
Module

x/easyts/mod.ts>WriteChannel

js library written with ts, use select and chan like golang in js.
Latest
interface WriteChannel
import { type WriteChannel } from "https://deno.land/x/easyts@0.1.2/mod.ts";

a write-only channel

Properties

readonly
isClosed: boolean

Returns whether the channel is closed

readonly
length: number

Returns the channel buffer size

readonly
capacity: number

Returns how much data the channel has buffered

Methods

write(val: T, exception?: boolean): boolean | Promise<boolean>

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

tryWrite(val: T, exception?: boolean): boolean

Attempt to write a value to the channel

close(): boolean

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

writeCase(val: T, exception?: boolean): WriteCase<T>

Create a case for select to write to