Spaces:
Runtime error
Runtime error
File size: 1,610 Bytes
cd8bd0a | 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | /**
* OmniRoute Electron Types
*
* TypeScript definitions for the Electron API exposed to the renderer process.
*
* Updated to reflect:
* - Fix #6: onServerStatus/onPortChanged return disposer functions
* - Removed removeServerStatusListener/removePortChangedListener (replaced by disposers)
*/
export interface AppInfo {
name: string;
version: string;
platform: "win32" | "darwin" | "linux";
isDev: boolean;
port: number;
}
export interface ServerStatus {
status: "starting" | "running" | "stopped" | "restarting" | "error";
port: number;
}
export interface ElectronAPI {
// ββ Invoke (async) βββββββββββββββββββββββββββββββββββββ
getAppInfo(): Promise<AppInfo>;
openExternal(url: string): Promise<void>;
getDataDir(): Promise<string>;
restartServer(): Promise<{ success: boolean }>;
// ββ Send (fire-and-forget) βββββββββββββββββββββββββββββ
minimizeWindow(): void;
maximizeWindow(): void;
closeWindow(): void;
// ββ Receive (returns disposer for cleanup) βββββββββββββ
onServerStatus(callback: (data: ServerStatus) => void): () => void;
onPortChanged(callback: (port: number) => void): () => void;
// ββ Static Properties ββββββββββββββββββββββββββββββββββ
isElectron: boolean;
platform: "win32" | "darwin" | "linux";
}
declare global {
interface Window {
electronAPI: ElectronAPI;
}
}
export {};
|