-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
30 lines (28 loc) · 909 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
const {app, BrowserWindow, globalShortcut} = require('electron')
function createWindow() {
// 创建浏览器窗口
win = new BrowserWindow({
width: 800,
height: 700,
resizable: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true, // 这里是关键设置
},
webContents: {
openDevTools: true //不想要控制台直接把这段删除
}
});
require('@electron/remote/main').initialize(); // 初始化
require('@electron/remote/main').enable(win.webContents);
win.loadFile('index.html')
win.setMenu(null);
}
// 应用程序准备就绪后打开一个窗口
app.on('ready', async () => {
globalShortcut.register('CommandOrControl+Shift+i', function () {
win.webContents.openDevTools()
});
createWindow();
});