forked from ameba23/mmt-metadata
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
59 lines (47 loc) · 1.17 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
const Path = require('path')
const url = require('url')
const {
app,
BrowserWindow,
ipcMain,
} = require('electron')
const Window = require('./lib/window')
const Menu = require('./lib/menu')
const appName = process.env.APP_NAME || "Better Multisig Wallet (BMW)"
var windows = {}
app.on('ready', () => {
Menu()
ServerProcess()
ipcMain.once('server-started', AppProcess)
ipcMain.on('open-background-devtools', openDevTools)
})
function ServerProcess () {
if (!windows.background) {
windows.background = Window(Path.join(__dirname, 'server.js'), {
show: false,
title: 'Server',
})
}
}
function AppProcess () {
if (!windows.main) {
windows.main = Window(Path.join(__dirname, 'app/index.js'), {
title: appName
})
windows.main.loadURL(url.format({
pathname: Path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}))
windows.main.on('closed', () => {
windows.main = null
windows.background = null
if (process.platform !== 'darwin') app.quit()
})
}
}
function openDevTools () {
if (windows.main) {
windows.main.webContents.openDevTools({ detach: true })
}
}