-
Notifications
You must be signed in to change notification settings - Fork 57
/
elect.js
52 lines (46 loc) · 1.28 KB
/
elect.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
const { app, BrowserWindow, dialog } = require('electron')
const isOnline = require('is-online')
let win = null
async function createWindow () {
// Initialize the window to our specified dimensions
win = new BrowserWindow(
{
maximizable: true,
icon: './app/assets/img/icon.icns' // for AppImage
}
)
if (await isOnline()) {
win.maximize()
// Specify entry point to default entry point of vue.js
win.loadURL('https://master.testnet.tomochain.com')
} else {
win.maximize()
return dialog.showMessageBox({
title:'No internet connection',
message:'Check your internet connection and try again.',
type:'warning',
buttons:['OK']
}, index => {
if (index === 0) {
win.close()
}
})
}
// Remove window once app is closed
win.on('closed', function () {
win = null
})
}
app.on('ready', createWindow)
// create the application window if the window variable is null
app.on('activate', () => {
if (win === null) {
createWindow()
}
})
// quit the app once closed
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
})