From aec9a41f662249d0b44315ceecc391ab054c4554 Mon Sep 17 00:00:00 2001 From: SaberAlter Date: Wed, 27 Jul 2022 00:05:20 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E5=9C=A8=E5=BA=94=E7=94=A8=E6=9C=AA?= =?UTF-8?q?=E6=89=93=E5=8C=85=E6=97=B6=E8=87=AA=E5=8A=A8=E6=89=93=E5=BC=80?= =?UTF-8?q?=20devTools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index 73740b1..eb35dab 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -2,6 +2,8 @@ import { app, BrowserWindow, shell, ipcMain } from 'electron' import { release } from 'os' import { join } from 'path' +const { isPackaged } = app + // Disable GPU Acceleration for Windows 7 if (release().startsWith('6.1')) app.disableHardwareAcceleration() @@ -46,13 +48,16 @@ async function createWindow() { }, }) - if (app.isPackaged) { + if (isPackaged) { win.loadFile(indexHtml) } else { win.loadURL(url) // win.webContents.openDevTools() } + // Open devTool if the app is not packaged + !isPackaged && win.webContents.openDevTools() + // Test actively push message to the Electron-Renderer win.webContents.on('did-finish-load', () => { win?.webContents.send('main-process-message', new Date().toLocaleString())