diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/index.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/index.ts b/src/main/index.ts index be494a4..68ae000 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1,10 +1,17 @@ import { app, BrowserWindow } from 'electron'; + declare const MAIN_WINDOW_WEBPACK_ENTRY: string; const isDevelopment = process.env.NODE_ENV !== 'production'; app.allowRendererProcessReuse = true; +async function installReactDevTools(): Promise<void> { + const { default: installExtension, REACT_DEVELOPER_TOOLS } = await import('electron-devtools-installer'); + const name = await installExtension(REACT_DEVELOPER_TOOLS); + console.log(`Added Extension: ${name}`); +} + function createWindow(): void { const window = new BrowserWindow({ webPreferences: { nodeIntegration: true } }); @@ -36,5 +43,13 @@ app.on('activate', () => { } }); +async function initialize(): Promise<void> { + if (isDevelopment) { + await installReactDevTools(); + } + + createWindow(); +} + // create main BrowserWindow when electron is ready -app.on('ready', createWindow); +app.on('ready', initialize); |