Skip to content

@statesync/electron


@statesync/electron / ElectronBroadcasterHandle

Interface: ElectronBroadcasterHandle

Defined in: main.ts:54

Handle returned by createElectronBroadcaster for sending invalidation events to renderer processes.

Process context: main process only.

Properties

topic

ts
readonly topic: string;

Defined in: main.ts:56

The sync topic this broadcaster is bound to.

Methods

invalidate()

ts
invalidate(revision, extra?): void;

Defined in: main.ts:69

Broadcasts an invalidation event to all target renderer windows.

Each target is guarded with isDestroyed() and a try/catch to handle the TOCTOU race inherent in Electron multi-window apps (a webContents can be destroyed between the check and the send() call).

Parameters

ParameterTypeDescription
revisionstringThe new revision string to broadcast.
extra?{ sourceId?: string; }Optional additional fields for the InvalidationEvent.
extra.sourceId?stringIdentifier of the source that produced this revision change.

Returns

void

Released under the MIT License.