summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2019-12-24 20:13:47 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2019-12-24 20:28:51 +0100
commit764cd8344df2dc9b2c271d868ae193b98b829af7 (patch)
tree026b23d62d5fc7df338f880e85c26459f8be1a6a /src/main
parent2f77cf7b7484beb3b94900f95d61fd2685c42ac2 (diff)
downloadrpgedit-764cd8344df2dc9b2c271d868ae193b98b829af7.tar
rpgedit-764cd8344df2dc9b2c271d868ae193b98b829af7.zip
Fix lint issues
Diffstat (limited to 'src/main')
-rw-r--r--src/main/index.ts18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/main/index.ts b/src/main/index.ts
index e1169b9..3a94ae5 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -5,11 +5,12 @@ 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;
+let mainWindow: BrowserWindow | null = null;
function getIndexURL(): string {
- if (isDevelopment)
+ if (isDevelopment) {
return `http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`;
+ }
return formatUrl({
pathname: path.join(__dirname, 'index.html'),
@@ -19,10 +20,11 @@ function getIndexURL(): string {
}
function createMainWindow(): BrowserWindow {
- const window = new BrowserWindow({webPreferences: {nodeIntegration: true}});
+ const window = new BrowserWindow({ webPreferences: { nodeIntegration: true } });
- if (isDevelopment)
+ if (isDevelopment) {
window.webContents.openDevTools();
+ }
window.loadURL(getIndexURL());
@@ -32,7 +34,7 @@ function createMainWindow(): BrowserWindow {
window.webContents.on('devtools-opened', () => {
window.webContents.focus();
- })
+ });
return window;
}
@@ -40,14 +42,16 @@ function createMainWindow(): BrowserWindow {
// 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')
+ 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)
+ if (!mainWindow) {
mainWindow = createMainWindow();
+ }
});
// create main BrowserWindow when electron is ready