-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathtypes.d.ts
More file actions
51 lines (43 loc) · 1.57 KB
/
types.d.ts
File metadata and controls
51 lines (43 loc) · 1.57 KB
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
/**
* 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 {};