-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
40 lines (34 loc) · 1.05 KB
/
main.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
'use strict';
const electron = require('electron')
const {app, BrowserWindow} = electron
var menubar = require('menubar')
var path = require('path')
const child_process = require('child_process');
// Let electron reloads by itself when webpack watches changes in ./app/
require('electron-reload')(__dirname)
var menu = menubar({
dir: __dirname,
index: `file://${__dirname}/app/menue.html`, // fix
width: 530,
height: 320
})
// To avoid being garbage collected
var mainWindow
var workerProcess
app.on('ready', () => {
workerProcess = child_process.exec('node ./server.js ',
function (error, stdout, stderr) {
if (error) {
console.log('Signal received: '+error.signal);
}
console.log('stdout: ' + stdout);
}
)
var mainWindow = new BrowserWindow({width: 660, height: 660})
mainWindow.loadURL(`file://${__dirname}/app/main.html`)
//mainWindow.webContents.openDevTools()
})
app.on('window-all-closed', function () {
workerProcess.kill('SIGINT');
app.quit();
});