Skip to main content

Interface: StateSyncServiceContract

Defined in: src/services/StateSyncService.ts:133

Contract for renderer-facing state synchronization operations.

Remarksโ€‹

Provides guarded access to preload-managed IPC endpoints so callers do not touch the window.electronAPI global directly. Implementations must ensure the Electron bridge is ready before invoking any underlying channel.

Propertiesโ€‹

getSyncStatusโ€‹

readonly getSyncStatus: () => Promise<{
lastSyncAt: number | null;
siteCount: number;
source: "cache" | "database" | "frontend" | "import" | "monitor-update";
synchronized: boolean;
}>;

Defined in: src/services/StateSyncService.ts:135

Retrieves the latest synchronization status snapshot from the backend.

Returnsโ€‹

Promise<{ lastSyncAt: number | null; siteCount: number; source: "cache" | "database" | "frontend" | "import" | "monitor-update"; synchronized: boolean; }>


initializeโ€‹

readonly initialize: () => Promise<void>;

Defined in: src/services/StateSyncService.ts:137

Ensures the preload bridge is available prior to IPC usage.

Returnsโ€‹

Promise<void>


onStateSyncEventโ€‹

readonly onStateSyncEvent: (handler: (event: StateSyncEventData) => void) => Promise<() => void>;

Defined in: src/services/StateSyncService.ts:142

Registers a handler for incremental state sync events and returns a cleanup callback.

Parametersโ€‹

handlerโ€‹

(event: StateSyncEventData) => void

Returnsโ€‹

Promise<() => void>


requestFullSyncโ€‹

readonly requestFullSync: () => Promise<{
completedAt: number;
revision: number;
siteCount: number;
sites: Site[];
source: "cache" | "database" | "frontend" | "import" | "monitor-update";
synchronized: boolean;
}>;

Defined in: src/services/StateSyncService.ts:149

Requests a full synchronization cycle and returns the backend result payload.

Returnsโ€‹

Promise<{ completedAt: number; revision: number; siteCount: number; sites: Site[]; source: "cache" | "database" | "frontend" | "import" | "monitor-update"; synchronized: boolean; }>