-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
59 lines (49 loc) · 1.27 KB
/
main.ts
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
57
58
// @ts-ignore
if (require('electron-squirrel-startup')) return
require('./app.ts')
// @ts-ignore
const { app, BrowserWindow, Menu } = require("electron")
// @ts-ignore
const path = require("path")
function start() {
// Hide Menu
if(process.platform === "darwin"){
// on macOS: Hide Menu by setting it to a empty array
// const menu = Menu.buildFromTemplate([])
// Menu.setApplicationMenu(menu)
}
else Menu.setApplicationMenu(null)
// @ts-expect-error
mainWindow = new BrowserWindow({
icon: path.join(__dirname, "./buildIcon/icon.png"),
width: 1280,
height: 720,
webPreferences:{
nodeIntegration: true,
contextIsolation: false,
// @ts-ignore
enableRemoteModule: true,
},
});
// @ts-expect-error
mainWindow.on('close', () => {
// @ts-expect-error
mainWindow = null
})
// @ts-expect-error
mainWindow.loadURL(`http://127.0.0.1:8080`);
};
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
// @ts-expect-error
if (mainWindow === null) {
start()
}
})
app.on('ready', start)