diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2020-03-17 18:43:22 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2020-03-17 18:43:22 +0100 |
commit | 6c8f2d780acd6c41d42de6b5fc8d84e765334b64 (patch) | |
tree | 5f157118407a571d6a2bf6d2563d2317b44fb186 /src/main | |
parent | 7dce448d9bd20fd72849dab94cef3bae253c7867 (diff) | |
download | rpgedit-6c8f2d780acd6c41d42de6b5fc8d84e765334b64.tar rpgedit-6c8f2d780acd6c41d42de6b5fc8d84e765334b64.zip |
Prepare for editor implementation
- Add React and Material UI
- Add React Developer Tools
- Add ESlint plugin and config
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); |