forked from ethereum/mist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
94 lines (73 loc) · 2.94 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const app = require('app'); // Module to control application life.
const BrowserWindow = require('browser-window'); // Module to create native browser window.
const ipc = require('ipc');
// const Menu = require('menu');
// const Tray = require('tray');
const menuItems = require('./menuItems');
var appIcon = null;
// const processRef = global.process;
// process.nextTick(function() { global.process = processRef; });
// Report crashes to our server.
require('crash-reporter').start();
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the javascript object is GCed.
var mainWindow = null;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
if (process.platform != 'darwin')
app.quit();
});
// Emitted when the application is activated while there is no opened windows.
// It usually happens when a user has closed all of application's windows and then
// click on the application's dock icon.
app.on('activate-with-no-open-windows', function () {
if (mainWindow) {
mainWindow.show();
}
return false;
});
// SETUP custom protocols
// app.commandLine.appendSwitch('register-standard-schemes', 'library,test,atom');
// app.commandLine.appendSwitch('host-rules', 'MAP *.google.com meteor.com');
// This method will be called when Electron has done everything
// initialization and ready for creating browser windows.
app.on('ready', function() {
// instantiate custom protocols
// require('./customProtocols.js');
// appIcon = new Tray('./icons/icon-tray.png');
// var contextMenu = Menu.buildFromTemplate([
// { label: 'Item1', type: 'radio' },
// { label: 'Item2', type: 'radio' },
// { label: 'Item3', type: 'radio', checked: true },
// { label: 'Item4', type: 'radio' },
// ]);
// appIcon.setToolTip('This is my application.');
// appIcon.setContextMenu(contextMenu);
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
'standard-window': false,
icon: './icons/icon_128x128.png',
'node-integration': false,
preload: __dirname +'/preloader.js'
// frame: false
// 'use-content-size': true,
});
// and load the index.html of the app.
// if() 'file://' + __dirname + '/interface/index.html
mainWindow.loadUrl('http://localhost:3000');
// Open the devtools.
// mainWindow.openDevTools();
// Emitted when the window is closed.
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
// instantiate the application menu
ipc.on('setupWebviewDevToolsMenu', function(e, webviews){
menuItems(mainWindow, webviews || []);
});
});