-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.js
56 lines (48 loc) · 1.37 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
// start geth in background
var newAccessToken = function() {
return require('crypto').randomBytes(16).toString('hex');
}
/*
var spawn = require('child_process').spawn;
var environment = {'accessToken': newAccessToken()};
var geth = spawn('geth', ['mist'], {env: environment});
geth.stderr.on('data', function(data) {
console.log(data.toString('utf-8'));
});
*/
var mist = require('app');
var BrowserWindow = require('browser-window');
var ipc = require('ipc');
var mainWindow = null;
mist.on('window-all-closed', function() {
if (process.platform != 'darwin') {
mist.quit();
}
});
mist.on('ready', function() {
mainWindow = new BrowserWindow({width: 800, height: 600, frame: false});
mainWindow.loadUrl('file://' + __dirname + '/index.html');
//mainWindow.openDevTools();
mainWindow.on('closed', function() {
mainWindow = null;
if (process.platform != 'darwin') {
mist.quit();
}
});
});
ipc.on('asynchronous-message', function(event, msg) {
if (msg == 'exit-window') {
mainWindow = null;
mist.quit();
} else if (msg == 'minimize-window') {
mainWindow.minimize();
} else if (msg == 'maximize-window') {
mainWindow.maximize();
} else if (msg == 'unmaximize-window') {
mainWindow.unmaximize();
} else if (msg == 'enter-fullscreen-window') {
mainWindow.setFullScreen(true);
} else if (msg == 'leave-fullscreen-window') {
mainWindow.setFullScreen(false);
}
});