From 6c8f2d780acd6c41d42de6b5fc8d84e765334b64 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 17 Mar 2020 18:43:22 +0100 Subject: Prepare for editor implementation - Add React and Material UI - Add React Developer Tools - Add ESlint plugin and config --- src/main/index.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/main') 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 { + 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 { + if (isDevelopment) { + await installReactDevTools(); + } + + createWindow(); +} + // create main BrowserWindow when electron is ready -app.on('ready', createWindow); +app.on('ready', initialize); -- cgit v1.2.3