-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
36 lines (33 loc) · 908 Bytes
/
index.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
const {app, BrowserWindow,globalShortcut} = require('electron');
const path = require('path');
const url = require('url');
let mainWindow = null;
function createMainWidow() {
mainWindow = null;
mainWindow = new BrowserWindow({
width: 1200,
height: 800
});
mainWindow.on('closed', function () {
mainWindow = null;
});
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true,
webPreferences: {webSecurity: false},
}));
//启动时打开调试工具,发布时应该注释
mainWindow.webContents.openDevTools();
}
app.on('ready', createMainWidow);
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', function () {
if (mainWindow === null) {
createMainWidow();
}
});