-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
37 lines (31 loc) · 902 Bytes
/
index.js
File metadata and controls
37 lines (31 loc) · 902 Bytes
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
const {app, BrowserWindow, ipcMain} = require('electron')
const electron = require('electron')
const Menu = electron.Menu
Menu.setApplicationMenu(null)
app.on('ready', () => {
const mainWindow = new BrowserWindow({
width:830,
height:520,
frame: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
}
})
mainWindow.loadFile('./src/1.html')
let ipcMain = require('electron').ipcMain;
ipcMain.on('window-min', function() {
mainWindow.minimize();
})
ipcMain.on('window-max', function() {
if (mainWindow.isMaximized()) {
mainWindow.restore();
} else {
mainWindow.maximize();
}
})
//接收关闭命令
ipcMain.on('window-close', function() {
mainWindow.close();
})
})