-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
65 lines (60 loc) · 1.5 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
global.__proto__ = require('./config/module_list');
var env = require('./config/environment');
var IPC = require('./libs/ipc');
var template = require('./libs/template.js');
app.on('ready', function(){
if(process.platform == 'darwin'){
ELECTRON.WINDOW = new BrowserWindow({
width: 1200,
'min-width':1000,
height: 600,
'min-height':600,
titleBarStyle:'hidden-inset',
icon:'./images/icon.png'
});
// menu = Menu.buildFromTemplate(template);
// Menu.setApplicationMenu(menu);
ELECTRON.WINDOW.on('blur',function(event){
ELECTRON.BLUR = true;
});
ELECTRON.WINDOW.on('focus',function(event){
ELECTRON.BLUR = false;
});
ELECTRON.WINDOW.on('close',function(event){
if(ELECTRON.QUIT){
app.quit()
} else {
if(ELECTRON.BLUR){
app.quit()
} else {
event.preventDefault();
ELECTRON.WINDOW.hide();
}
}
});
} else {
ELECTRON.WINDOW = new BrowserWindow({
width: 1200,
'min-width':1000,
height: 600,
'min-height':600,
frame:'false',
icon:'./images/icon.png'
});
if(process.env.NODE_ENV == 'develop')
ELECTRON.TRAY = new Tray('./icon.png');
else
ELECTRON.TRAY = new Tray(process.resourcesPath + '/app.asar/icon.png');
}
app.on('activate', function(e, visible){
if(visible == false){
ELECTRON.WINDOW.show();
}
});
ELECTRON.WINDOW.loadUrl('file://' + __dirname + '/index/index.html');
ELECTRON.WINDOW.openDevTools()
});
app.on('window-all-closed', function(){
if(process.platform != 'darwin')
app.quit();
});