Skip to content

@statesync/electron


@statesync/electron / ElectronSnapshotHandlerOptions

Interface: ElectronSnapshotHandlerOptions<T>

Defined in: main.ts:145

Configuration options for createElectronSnapshotHandler.

Type Parameters

Type ParameterDescription
TThe application-specific snapshot data type.

Properties

channel?

ts
optional channel: string;

Defined in: main.ts:183

Override the default IPC channel name for snapshot requests.

Defaults to statesync:<topic>:snapshot (produced by snapshotChannel).


getSnapshot()

ts
getSnapshot: () => SnapshotEnvelope<T> | Promise<SnapshotEnvelope<T>>;

Defined in: main.ts:158

Returns the current snapshot envelope for the given topic.

This callback may be invoked concurrently from multiple renderer windows (each renderer calls ipcRenderer.invoke() independently). Implementations must be safe for concurrent invocations and should avoid side effects.

Returns

SnapshotEnvelope<T> | Promise<SnapshotEnvelope<T>>

The current snapshot, synchronously or as a promise.


handle

ts
handle: ElectronIpcMainHandle;

Defined in: main.ts:167

The ipcMain.handle function (or a compatible mock).

Used to register the snapshot request handler on the IPC channel.

See

ElectronIpcMainHandle


removeHandler

ts
removeHandler: ElectronIpcMainRemoveHandler;

Defined in: main.ts:176

The ipcMain.removeHandler function (or a compatible mock).

Used by ElectronSnapshotHandlerHandle.dispose to unregister the handler.

See

ElectronIpcMainRemoveHandler


topic

ts
topic: string;

Defined in: main.ts:147

The sync topic identifier (e.g. "user-profile").

Released under the MIT License.