Skip to content

Dispatcher

Responsible for sending messages from a Source to an associated WorkerSource.

Methods

broadcast()

broadcast<T>(type: T, data: RequestResponseMessageMap[T][0]): Promise<RequestResponseMessageMap[T][1][]>

Broadcast a message to all Workers.

Type parameters

Type parameter
T extends MessageType

Parameters

Parameter Type
type T
data RequestResponseMessageMap[T][0]

Returns

Promise<RequestResponseMessageMap[T][1][]>

Source

src/util/dispatcher.ts:38


getActor()

getActor(): Actor

Acquires an actor to dispatch messages to. The actors are distributed in round-robin fashion.

Returns

Actor

An actor object backed by a web worker for processing messages.

Source

src/util/dispatcher.ts:50