-
-
Notifications
You must be signed in to change notification settings - Fork 119
/
main.js
executable file
·52 lines (38 loc) · 896 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
42
43
44
45
46
47
48
49
50
51
52
const {
app,
BrowserWindow,
ipcMain
} = require('electron')
const electron = require('electron')
let win
function createWindow() {
const _width = 1200, _height = 800
win = new BrowserWindow({
width: _width,
height: _height,
minWidth: 800,
minHeight: 600,
icon: './assets/img/icon.png'
})
try {
const screenSize = electron.screen.getPrimaryDisplay().size;
win.setPosition((screenSize.width - _width) / 2,
(screenSize.height - _height) / 2)
}
catch (er) {
win.center()
}
win.setMenu(null)
win.loadURL(`file://${__dirname}/bundle/index.html`)
win.on("closed", () => {
win = null;
});
}
app.on("ready", createWindow)
app.on("window-all-closed", () => {
app.quit()
})
app.on("activate", () => {
if (win === null)
createWindow()
})