forked from muninrpc/muninrpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_process.js
43 lines (30 loc) · 1.12 KB
/
main_process.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
// Basic init
const electron = require('electron')
const {app, BrowserWindow} = electron
// import installExtension, { REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS } from 'electron-devtools-installer';
const installExtension = require('electron-devtools-installer');
// Let electron reloads by itself when webpack watches changes in ./app/
require('electron-reload')(__dirname)
// To avoid being garbage collected
let mainWindow
app.on('ready', () => {
// ***NOTE***
// Set CSP before release
mainWindow = new BrowserWindow(
{
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
},
}
)
mainWindow.loadFile(`./app/index.html`)
installExtension.default(installExtension.REACT_DEVELOPER_TOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
installExtension.default(installExtension.REDUX_DEVTOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
mainWindow.webContents.openDevTools()
})