From aec9a41f662249d0b44315ceecc391ab054c4554 Mon Sep 17 00:00:00 2001 From: SaberAlter Date: Wed, 27 Jul 2022 00:05:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feature:=20=E5=9C=A8=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E6=9C=AA=E6=89=93=E5=8C=85=E6=97=B6=E8=87=AA=E5=8A=A8=E6=89=93?= =?UTF-8?q?=E5=BC=80=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()) From 0d1fe635d35631165a78dd5dec008c8f92f36b7c Mon Sep 17 00:00:00 2001 From: SaberA1ter <73547598+SaberA1ter@users.noreply.github.com> Date: Wed, 27 Jul 2022 00:36:17 +0800 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20=E5=AF=B9=E4=BA=8E=E6=89=93?= =?UTF-8?q?=E5=BC=80=20devTools=20=E4=BB=A5=E8=A7=A3=E9=99=A4=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E6=9B=BF=E4=BB=A3=E6=96=B0=E5=A2=9E=E4=B8=80=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index eb35dab..230129a 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -52,12 +52,10 @@ async function createWindow() { win.loadFile(indexHtml) } else { win.loadURL(url) - // win.webContents.openDevTools() + // Open devTool if the app is not packaged + 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()) From 039c272fb252fa1b2542e82ccf89cb42bd4b3806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Wed, 27 Jul 2022 07:37:41 +0800 Subject: [PATCH 3/3] chore: revert --- electron/main/index.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index 230129a..70f0e30 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -2,8 +2,6 @@ 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() @@ -48,7 +46,7 @@ async function createWindow() { }, }) - if (isPackaged) { + if (app.isPackaged) { win.loadFile(indexHtml) } else { win.loadURL(url)