Skip to main content
Module

x/async_channels/broadcast.ts>BroadcastChannel

Inspired by Go & Clojure Channels, async_channels provides channels as an asynchronous communication method between asynchronous functions.
Go to Latest
class BroadcastChannel
import { BroadcastChannel } from "https://deno.land/x/async_channels@v1.0.0-alpha54/broadcast.ts";

Constructors

new
BroadcastChannel(topicFn: (val: TMsg) => TTopic, options?: BroadcastChannelOptions)

Type Parameters

TMsg
TTopic

Properties

protected
fnSubscribers: Map<TopicFn<TTopic>, Set<SendCloser<TMsg>>>
protected
readonly
options: BroadcastChannelOptions
protected
subscribers: Map<TTopic | symbol, Set<SendCloser<TMsg>>>
readonly
isOpen

Methods

protected
debug(...args: unknown[])
protected
error(...args: unknown[])
send(msg: TMsg, abortCtrl?: AbortController): Promise<void>
subscribe(topic: TTopic | TopicFn<TTopic>): [Receiver<TMsg>, () => void]
with<T, TThis extends BroadcastChannel<TMsg, TTopic>>(this: TThis, fn: (t: TThis) => T): T

Static Methods

from<TMsg, TTopic>(
input: Iterable<TMsg> | AsyncIterable<TMsg>,
topicFn: (val: TMsg) => TTopic,
): Subscribable<TMsg, TTopic>