Skip to content

Commit 05f685c

Browse files
committed
fixed an issue with crash on startup
1 parent cf3a18a commit 05f685c

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

electron/main.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,45 @@
1-
const { app, BrowserWindow, ipcMain } = require('electron');
2-
const path = require('path');
3-
const url = require('url');
4-
const { channels } = require('../src/shared/constants');
1+
const { app, BrowserWindow, ipcMain } = require("electron");
2+
const path = require("path");
3+
const url = require("url");
4+
const { channels } = require("../src/shared/constants");
55

66
let mainWindow;
77

8-
function createWindow () {
9-
const startUrl = process.env.ELECTRON_START_URL || url.format({
10-
pathname: path.join(__dirname, '../index.html'),
11-
protocol: 'file:',
12-
slashes: true,
8+
function createWindow() {
9+
const startUrl =
10+
process.env.ELECTRON_START_URL ||
11+
url.format({
12+
pathname: path.join(__dirname, "../index.html"),
13+
protocol: "file:",
14+
slashes: true,
15+
});
16+
mainWindow = new BrowserWindow({
17+
width: 800,
18+
height: 600,
19+
webPreferences: { nodeIntegration: true },
1320
});
14-
mainWindow = new BrowserWindow({ width: 800, height: 600 });
1521
mainWindow.loadURL(startUrl);
16-
mainWindow.on('closed', function () {
22+
mainWindow.on("closed", function() {
1723
mainWindow = null;
1824
});
1925
}
2026

21-
app.on('ready', createWindow);
27+
app.on("ready", createWindow);
2228

23-
app.on('window-all-closed', function () {
24-
if (process.platform !== 'darwin') {
29+
app.on("window-all-closed", function() {
30+
if (process.platform !== "darwin") {
2531
app.quit();
2632
}
2733
});
2834

29-
app.on('activate', function () {
35+
app.on("activate", function() {
3036
if (mainWindow === null) {
3137
createWindow();
3238
}
3339
});
3440

3541
ipcMain.on(channels.APP_INFO, (event) => {
36-
event.sender.send(channels.APP_INFO, {
42+
event.sender.send(channels.APP_INFO, {
3743
appName: app.getName(),
3844
appVersion: app.getVersion(),
3945
});

0 commit comments

Comments
 (0)