-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
83 lines (69 loc) · 1.82 KB
/
app.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
const electron = require("electron");
const ipc = electron.ipcMain;
const app = electron.app;
const Menu = electron.Menu;
const Tray = electron.Tray;
const path = require("path");
const url = require("url");
const fs = require("fs");
let splashScreen;
let mainwindow;
let loaded = false;
let icon_path = path.join(__dirname, "ResourcesStatic", "icons");
if(process.platform == "win32"){
icon_path = path.join(icon_path, "iconRound.ico");
}
else{
icon_path = path.join(icon_path, "iconRound.png");
}
function close_windows(){
mainwindow = null;
splashScreen = null;
app.exit();
}
global.editor = {
modules: new Array(),
modulesUsage: new Array(),
defaultLayout: null,
layout: new Array(),
};
app.on("ready", function(){
splashScreen = new electron.BrowserWindow({
width: 400,
height: 490,
icon: icon_path,
frame: false
});
splashScreen.loadURL(url.format({
pathname: path.join(__dirname, "splashScreen.html"),
protocol: "file:",
slashes: true
}));
let mainwindowSize = electron.screen.getPrimaryDisplay().workAreaSize
mainwindow = new electron.BrowserWindow({
width: mainwindowSize.width,
height: mainwindowSize.height,
icon: icon_path,
show: false
});
mainwindow.loadURL(url.format({
pathname: path.join(__dirname, "index.html"),
protocol: "file:",
slashes: true
}));
splashScreen.on("closed", function(){
if(loaded){
splashScreen = null;
}
else{
close_windows();
}
});
mainwindow.on("closed", close_windows);
ipc.on("load_msg", function(event, data){
splashScreen.webContents.send("splash-screen-msg", data);
if(data.state == 10){
loaded = true;
}
});
});