generated from cis3296f22/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
41 lines (32 loc) · 936 Bytes
/
main.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
/**
* main javascript file to start the app and create a new window as well as quit the app
*/
const { app, BrowserWindow, ipcMain } = require("electron");
let win;
const createWindow = () => {
win = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
width: 1800,
height: 1200,
frame: false, // Comment or remove this line to enable the default window frame
icon: "components/images/OO_Icon.png",
});
win.loadFile("index.html");
// Uncomment the following line if you want to keep the frameless window draggable
// win.webContents.on("did-finish-load", () => { win.setTitle("Your Title"); });
win.on("closed", () => {
win = null;
});
};
app.whenReady().then(() => {
createWindow();
ipcMain.on("close-app", () => {
app.quit();
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") app.quit();
});