-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.js
35 lines (29 loc) · 919 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
const path = require("path")
const { app, BrowserWindow } = require('electron')
const { initIPC } = require("./src/worker/ipc")
async function createWindow() {
const win = new BrowserWindow({
width: 400,
height: 230,
resizable: false,
show: false, // Hiding the window as long as the content is loading.
autoHideMenuBar: true,
backgroundColor: "#ffffff",
icon: path.join(__dirname, "src", "resources", "icon.ico"),
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
sandbox: true,
preload: path.join(__dirname, "src", "worker", "preload.js")
},
})
await win.loadFile(path.join(__dirname, "src", "renderer", "index.html"))
initIPC()
win.show() // At this point our app is fully available. Let's show it to the user.
}
app.on("ready", async () => {
await createWindow()
})
app.on('window-all-closed', () => {
app.quit()
})