Skip to main content
Module

x/easyts/mod.ts>ReadCase

js library written with ts, use select and chan like golang in js.
class ReadCase
implements ReadCaseLike
import { ReadCase } from "https://deno.land/x/easyts@0.1.0/mod.ts";

Constructors

new
private
ReadCase(ch: Chan<T>)

Properties

private
optional
read_: IteratorResult<T>
readonly
isReady: boolean

Returns whether this case is ready

Methods

do(resolve: (c: CaseLike) => void, reject: (c: CaseLike) => void): Connection
invoke(): Promise<void>
read(): undefined | T

Returns the value read by the case, throws an exception if the case is not ready

readRaw(): [undefined, false] | [T, true]

Returns the value read by the case, throws an exception if the case is not ready

reset(): void

reset read-write status

tryInvoke(): boolean