File size: 925 Bytes
1dbc34b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /**
* Electron main process shared state
*
* Centralized state container to avoid circular dependencies.
* All modules access shared state through this object.
*/
import { BrowserWindow } from 'electron';
import { ChildProcess } from 'child_process';
import { Server } from 'http';
import { DEFAULT_SERVER_PORT, DEFAULT_STATIC_PORT } from './constants';
export interface ElectronState {
mainWindow: BrowserWindow | null;
serverProcess: ChildProcess | null;
staticServer: Server | null;
serverPort: number;
staticPort: number;
apiKey: string | null;
isExternalServerMode: boolean;
saveWindowBoundsTimeout: ReturnType<typeof setTimeout> | null;
}
export const state: ElectronState = {
mainWindow: null,
serverProcess: null,
staticServer: null,
serverPort: DEFAULT_SERVER_PORT,
staticPort: DEFAULT_STATIC_PORT,
apiKey: null,
isExternalServerMode: false,
saveWindowBoundsTimeout: null,
};
|