-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
63 lines (52 loc) · 1.28 KB
/
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
53
54
55
56
57
58
59
60
61
62
63
const electron = require('electron')
const {app, BrowserWindow, Menu } = electron
const path = require('path')
const url = require('url')
// Keep a global reference so the garbage collector does not destroy our app
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
minWidth: 1124, // The minimum width...
minHeight: 700,// The minimum height
alwaysOnTop:false,
icon:'icon.ico',
scrollBounce: false,
webPreferences: {
nodeIntegration: true
}
// frame:false
})
// Load the index.html file
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}))
mainWindow.on('closed', () => {
mainWindow = null
})
};
// Opens the about window
// Create the window then the app is ready
app.on('ready', () => {
createWindow()
electron.powerMonitor.on('on-ac', () => {
mainWindow.restore()
})
electron.powerMonitor.on('on-battery', () => {
mainWindow.minimize()
})
})
// Quit when all windows are closed
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
// Reopen the app on macOS
app.on('activate', () => {
if (mainWindow === null) {
createWindow()
}
})