diff --git a/src/main.ts b/src/main.ts index dfc53bc..978dcef 100644 --- a/src/main.ts +++ b/src/main.ts @@ -39,6 +39,7 @@ function createWindow(): void { }, }); void mainWindow.loadFile(path.join(__dirname, 'index.html')); + mainWindow.webContents.openDevTools(); mainWindow.on('close', (e: Electron.Event) => { if (!isQuitting) { e.preventDefault(); diff --git a/src/renderer.ts b/src/renderer.ts index 346a97b..7c5f806 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -1,58 +1,3 @@ -interface DeviceEntry { - vendorId: number; - productId: number; - displayName: string; - manufacturer: string; - product: string; - serialNumber: string; -} - -interface CpuTempResult { - main: number; - cores: number[]; - max: number; - error?: string; -} - -interface RamResult { - total: number; - free: number; - used: number; - usedPercent: string; - error?: string; -} - -interface GpuController { - vendor: string; - model: string; - temperatureGpu: number | null; - memoryUsed: number | null; - memoryTotal: number | null; -} - -interface ElectronAPI { - systemCpuTemp: () => Promise; - systemRam: () => Promise; - systemGpu: () => Promise; - usbListDevices: () => Promise; - usbConnect: (vendorId: number, productId: number) => Promise<{ success: boolean } | { error: string }>; - prefsGet: (key?: string) => Promise; - prefsSet: (key: string, value: unknown) => Promise; - prefsDelete: (key: string) => Promise; - dialogOpenFile: (options?: unknown) => Promise<{ canceled: boolean; filePaths: string[] }>; - dialogSaveFile: (options?: unknown) => Promise<{ canceled: boolean; filePath: string }>; -} - -declare global { - interface Window { - electronAPI: ElectronAPI; - } -} - -export {}; - -const api: ElectronAPI = window.electronAPI; - function isError(result: T | { error: string }): result is { error: string } { return result !== null && typeof result === 'object' && 'error' in result; } @@ -61,6 +6,8 @@ function formatError(result: { error: string }): string { return `Error: ${result.error}`; } +const api: ElectronAPI = window.electronAPI; + // --- System Info --- async function refreshSystemInfo(): Promise { const [cpuTemp, ram, gpu] = await Promise.all([ diff --git a/tsconfig.json b/tsconfig.json index f970986..b9ae332 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,5 +18,5 @@ "noFallthroughCasesInSwitch": true, "noImplicitReturns": true }, - "include": ["src/**/*.ts"] + "include": ["src"] }