Class: MainProcessStateClient
Defined in: utils/state/integration/mainProcessStateClient.ts:174
Renderer-side interface to state held in the Electron main process.
Constructorsβ
Constructorβ
new MainProcessStateClient(__namedParameters?: MainProcessStateClientOptions): MainProcessStateClient;
Defined in: utils/state/integration/mainProcessStateClient.ts:184
Parametersβ
__namedParameters?β
MainProcessStateClientOptions = {}
Returnsβ
MainProcessStateClient
Propertiesβ
_isInitializedβ
private _isInitialized: boolean = false;
Defined in: utils/state/integration/mainProcessStateClient.ts:175
_electronApiScopeβ
private readonly _electronApiScope:
| RendererElectronApiScope
| undefined;
Defined in: utils/state/integration/mainProcessStateClient.ts:177
_listenersβ
private readonly _listeners: Map<string, Set<(change: StateChangeEvent) => void>>;
Defined in: utils/state/integration/mainProcessStateClient.ts:179
Methodsβ
_init()β
private _init(): void;
Defined in: utils/state/integration/mainProcessStateClient.ts:191
Returnsβ
void
get()β
get(path?: MainProcessStateReadablePath): Promise<MainStateIpcValue>;
Defined in: utils/state/integration/mainProcessStateClient.ts:216
Gets a value from main process state.
Parametersβ
path?β
Returnsβ
Throwsβ
Error when the preload state bridge is unavailable or the IPC call fails.
getDiagnostics()β
getDiagnostics(): Promise<{
errors: MainStateIpcValue[];
metrics: MainStateIpcValue;
operations: Record<string, Operation>;
}>;
Defined in: utils/state/integration/mainProcessStateClient.ts:236
Gets diagnostic state from the main process state manager.
Returnsβ
Promise<{
errors: MainStateIpcValue[];
metrics: MainStateIpcValue;
operations: Record<string, Operation>;
}>
getErrors()β
getErrors(limit?: number): Promise<MainStateIpcValue[]>;
Defined in: utils/state/integration/mainProcessStateClient.ts:260
Gets recent state-manager errors.
Parametersβ
limit?β
number = 50
Returnsβ
Throwsβ
Error when the preload state bridge is unavailable or the IPC call fails.
getGyazoServerState()β
getGyazoServerState(): Promise<{
port: number | null;
server: MainStateIpcValue;
}>;
Defined in: utils/state/integration/mainProcessStateClient.ts:275
Gets the current Gyazo server state from main process state.
Returnsβ
Promise<{
port: number | null;
server: MainStateIpcValue;
}>
getLoadedFilePath()β
getLoadedFilePath(): Promise<string | null>;
Defined in: utils/state/integration/mainProcessStateClient.ts:288
Gets the currently loaded FIT file path.
Returnsβ
Promise<string | null>
getMainWindow()β
getMainWindow(): Promise<MainStateIpcValue>;
Defined in: utils/state/integration/mainProcessStateClient.ts:293
Gets the serialized main window reference from state.
Returnsβ
getMetrics()β
getMetrics(): Promise<MainStateIpcValue>;
Defined in: utils/state/integration/mainProcessStateClient.ts:303
Gets performance metrics from the main process state manager.
Returnsβ
Throwsβ
Error when the preload state bridge is unavailable or the IPC call fails.
getOperation()β
getOperation(operationId: string): Promise<MainStateIpcValue>;
Defined in: utils/state/integration/mainProcessStateClient.ts:323
Gets the status of a specific operation.
Parametersβ
operationIdβ
string
Returnsβ
Throwsβ
Error when the preload state bridge is unavailable or the IPC call fails.
getOperations()β
getOperations(): Promise<Record<string, MainStateIpcValue>>;
Defined in: utils/state/integration/mainProcessStateClient.ts:343
Gets all tracked operations from the main process state manager.
Returnsβ
Promise<Record<string, MainStateIpcValue>>
Throwsβ
Error when the preload state bridge is unavailable or the IPC call fails.
isAvailable()β
isAvailable(): boolean;
Defined in: utils/state/integration/mainProcessStateClient.ts:358
Checks whether the preload state bridge is available.
Returnsβ
boolean
listen()β
listen(path: MainProcessStateListenPath, callback: (change: StateChangeEvent) => void): Promise<() => void>;
Defined in: utils/state/integration/mainProcessStateClient.ts:369
Listens for changes to a specific main-process state path.
Parametersβ
pathβ
callbackβ
(change: StateChangeEvent) => void
Returnsβ
Promise<() => void>
Throwsβ
TypeError when callback is not a function.
Throwsβ
Error when the preload state bridge is unavailable or the IPC call fails.
set()β
set(
path: MainProcessStateWritablePath,
value: MainStateIpcValue,
options?: MainStateSetOptions
): Promise<boolean>;
Defined in: utils/state/integration/mainProcessStateClient.ts:405
Sets a value in renderer-writable main process state.
Parametersβ
pathβ
valueβ
options?β
MainStateSetOptions = {}
Returnsβ
Promise<boolean>
Throwsβ
Error when the preload state bridge is unavailable or the IPC call fails.
setLoadedFilePath()β
setLoadedFilePath(filePath: string | null): Promise<boolean>;
Defined in: utils/state/integration/mainProcessStateClient.ts:438
Sets or clears the currently loaded FIT file path.
Parametersβ
filePathβ
string | null
Returnsβ
Promise<boolean>
requireElectronAPI()β
private requireElectronAPI(): MainStateElectronAPI;
Defined in: utils/state/integration/mainProcessStateClient.ts:442
Returnsβ
getElectronAPI()β
private getElectronAPI():
| MainStateElectronAPI
| null;
Defined in: utils/state/integration/mainProcessStateClient.ts:451
Returnsβ
| MainStateElectronAPI
| null