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())