diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2019-12-24 14:25:03 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2019-12-24 14:25:03 +0100 |
commit | 53c18527578b313e767810cedf0b1979d3e6cd77 (patch) | |
tree | 089efe0e84c0a02a01a3a7e14fca70d7eb1980b8 /src | |
parent | 3c51a1994f41b625823c4f15e92396b5498ce23c (diff) | |
download | rpgedit-53c18527578b313e767810cedf0b1979d3e6cd77.tar rpgedit-53c18527578b313e767810cedf0b1979d3e6cd77.zip |
Update dependencies
Diffstat (limited to 'src')
-rw-r--r-- | src/main/index.ts | 9 | ||||
-rw-r--r-- | src/renderer/runtime/view/renderer/renderer.ts | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/main/index.ts b/src/main/index.ts index a4beb71..e1169b9 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -4,6 +4,7 @@ import { format as formatUrl } from 'url'; const isDevelopment = process.env.NODE_ENV !== 'production'; +// global reference to mainWindow (necessary to prevent window from being garbage collected) let mainWindow: BrowserWindow|null = null; function getIndexURL(): string { @@ -18,7 +19,7 @@ function getIndexURL(): string { } function createMainWindow(): BrowserWindow { - const window = new BrowserWindow(); + const window = new BrowserWindow({webPreferences: {nodeIntegration: true}}); if (isDevelopment) window.webContents.openDevTools(); @@ -31,21 +32,25 @@ function createMainWindow(): BrowserWindow { window.webContents.on('devtools-opened', () => { window.webContents.focus(); - }); + }) return window; } +// quit application when all windows are closed app.on('window-all-closed', () => { + // on macOS it is common for applications to stay open until the user explicitly quits if (process.platform !== 'darwin') app.quit(); }); app.on('activate', () => { + // on macOS it is common to re-create a window even after all windows have been closed if (!mainWindow) mainWindow = createMainWindow(); }); +// create main BrowserWindow when electron is ready app.on('ready', () => { mainWindow = createMainWindow(); }); diff --git a/src/renderer/runtime/view/renderer/renderer.ts b/src/renderer/runtime/view/renderer/renderer.ts index 9f711d3..90583a6 100644 --- a/src/renderer/runtime/view/renderer/renderer.ts +++ b/src/renderer/runtime/view/renderer/renderer.ts @@ -89,9 +89,7 @@ export class Renderer { } private mkContext(): WebGLRenderingContext { - const gl = ( - this.canvas.getContext('webgl') || this.canvas.getContext('experimental-webgl') - ); + const gl = this.canvas.getContext('webgl'); if (!gl) throw new Error('unable to initialize WebGL context'); |