-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
46 lines (37 loc) · 890 Bytes
/
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
41
42
43
44
45
46
var electron = require("electron")
var cp = require("child_process");
var app = electron.app;
var BrowserWindow = electron.BrowserWindow;
var model = {
window: null,
engine: null,
port: 3000
};
// model.engine = cp.spawn("./dist/build/radler/radler");
function createWindow() {
model.window = new BrowserWindow({
width: 1000,
height: 800
});
model.window.loadFile("public/index.html");
model.window.openDevTools();
model.window.webContents.on("did-finish-load", function () {
model.window.webContents.send('init', {
port: model.port
});
});
model.window.on("closed", function () {
model.window = null
});
}
app.on("ready", createWindow);
app.on("window-all-closed", function () {
if (process.platform !== "darwin") {
app.quit()
}
});
app.on("activate", function () {
if (model.window === null) {
createWindow();
}
});