-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain_dev.js
56 lines (48 loc) · 1.29 KB
/
main_dev.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const { app, BrowserWindow, ipcMain } = require("electron");
const guess_shell_path = function(){
if (process.platform == "win32") {
return process.env["ComSpec"];
} else {
return process.env["SHELL"];
}
};
if (process.argv.includes("--hot-reload")) {
try {
require("electron-reloader")(module);
} catch {}
}
require("@electron/remote/main").initialize();
app.commandLine.appendSwitch("remote-debugging-port", "9541");
/** @type {BrowserWindow | null | undefined} */
let win;
const createWindow = () => {
win = new BrowserWindow({
width: 1200,
height: 600,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
minWidth: 800,
minHeight: 600
});
require("@electron/remote/main").enable(win.webContents);
win.loadFile("./App/start.html");
win.webContents.setWindowOpenHandler(({ url }) => {
let new_win = new BrowserWindow({
width: 1200,
height: 600,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
minWidth: 800,
minHeight: 600
});
require("@electron/remote/main").enable(new_win.webContents);
new_win.loadURL(url);
new_win.webContents.openDevTools();
});
win.webContents.openDevTools();
};
app.whenReady().then(() => createWindow());