Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/easyts/signals/signals.ts>Signals

js library written with ts, use select and chan like golang in js.
Latest
class Signals
import { Signals } from "https://deno.land/x/easyts@0.1.3/signals/signals.ts";

Signals/Slots, you can associate multiple Slots with Signals, when Signals generate signals, Slots will be called in turn

Constructors

new
Signals(combiner?: Combiner<T, TR>)

Properties

private
cons_: Array<Connection<T, TR>>

Connected Signals/Slots

readonly
conns: Iterator<Connection<T, TR>>

Returns an iterator to iterate over all connections

readonly
isEmpty: boolean

if there is no connections return it rue

readonly
length: number

Returns the number of connections

readonly
slots: Iterator<Slot<T, TR>>

Returns an iterator to iterate over all slots

readonly
value: TR | undefined

If there is a combiner, return the latest value of the combiner

Methods

connect(slot: Slot<T, TR>, tag?: any): Connection<T, TR>

connect Slots to Signals

connectSlot(slot: SlotCallback<T, TR>, tag?: any): Connection<T, TR>

connect Signals/Slots

Disconnect all connections from slot to this signals

disconnectTag(tag: any)

Disconnect all tags

delete all slots

signal(val: T, combiner?: Combiner<T, TR>): void

Generate a signal to call all Slots