This repository has been archived by the owner on Jun 3, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.js
65 lines (51 loc) · 1.48 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
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
var app = require('app'),
BrowserWindow = require('browser-window'),
Menu = require('menu'),
runtime = require('./core/runtime'),
appMenu = require('./core/app-menu');
require('crash-reporter').start();
// Load external modules
var mods = require('./core/modules');
mods.load(runtime);
var mainWindow = null;
var menu = null;
app.on('window-all-closed', function () {
//if (process.platform !== 'darwin') {
app.quit();
//}
});
app.on('ready', function () {
runtime.emit(runtime.events.INIT_ROUTES, appMenu);
mainWindow = new BrowserWindow({
width: 800,
height: 600
});
// initialize runtime reference to main window
runtime.windowId = mainWindow.id;
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.focus();
mainWindow.on('closed', function () {
mainWindow = null;
});
// Dock Menu (Mac)
if (process.platform === 'darwin') {
var dockMenu = Menu.buildFromTemplate([
{ label: 'New Window', click: function() { console.log('New Window'); } },
{ label: 'New Window with Settings', submenu: [
{ label: 'Basic' },
{ label: 'Pro'},
]},
{ label: 'New Command...'},
]);
app.dock.setMenu(dockMenu);
}
// Application Menu
runtime.emit(runtime.events.INIT_APP_MENU, appMenu);
var template = appMenu.template;
menu = Menu.buildFromTemplate(template);
if (process.platform === 'darwin') {
Menu.setApplicationMenu(menu);
} else {
mainWindow.setMenu(menu);
}
});