Skip to content

Dispatcher

Defined in: src/util/dispatcher.ts:12

Responsible for sending messages from a Source to an associated worker source (usually with the same name).

Methods

broadcast()

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

Defined in: src/util/dispatcher.ts:36

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][]>


getActor()

getActor(): Actor

Defined in: src/util/dispatcher.ts:48

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.