Skip to main content
Module

x/deco/mod.ts>Multicast

Deco is a utility library for Deno developers
Very Popular
Go to Latest
class Multicast
implements AsyncIterable<T>
import { Multicast } from "https://deno.land/x/deco@0.10.3/mod.ts";

Multicasts pushed values to a variable number of async iterable iterators as receivers or subscribers.

Does not buffer pushed values; if no receivers are registered, pushed values are silently discarded.

Constructors

new
Multicast(init?: () => PushAdapter<T>)

Properties

readonly
receivers: Set<PushAdapter<T>>
readonly
size

Number of receivers.

Methods

optional
onReceiverAdded(): void
optional
onReceiverRemoved(): void
optional
onStart(): void
optional
onStop(): void
push(value: T): this

Pushes a value to all registered receivers.

[Symbol.asyncIterator](): AsyncIterableIterator<T>

Creates and registers a receiver.