forked from gabrielbull/react-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
43 lines (37 loc) · 848 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
37
38
39
40
41
42
43
const electron = require('electron');
const { app, BrowserWindow, Menu } = electron;
let mainWnd = null;
function createMainWnd() {
mainWnd = new BrowserWindow({
width:800,
height:600,
minWidth:800,
maxWidth: 800,
minHeight: 600,
maxHeight: 600,
backgroundColor:'#fbf2db',
useContentSize: true,
show: false,
webPreferences: {
webSecurity: false
}
// frame: false,
// titleBarStyle: 'hidden'
});
mainWnd.loadURL('http://127.0.0.1:6000/index.html');
mainWnd.on('ready-to-show', ()=>{
Menu.setApplicationMenu(null);
mainWnd.show();
mainWnd.webContents.openDevTools({ detach:true });
});
mainWnd.on('closed', () => {
mainWnd = null;
process.exit();
});
}
app.on('ready', ()=>{
createMainWnd();
});
app.on('window-all-closed', () => {
app.quit();
});