-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.js
More file actions
75 lines (61 loc) · 1.84 KB
/
main.js
File metadata and controls
75 lines (61 loc) · 1.84 KB
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
'use strict'
const electron = require('electron')
const app = electron.app
const globalShortcut = electron.globalShortcut
const os = require('os')
const path = require('path')
const config = require(path.join(__dirname, 'package.json'))
const BrowserWindow = electron.BrowserWindow
const globalConfig = require(path.join(__dirname, 'config.json'))
app.setName(config.productName)
var fs = require('fs');
let multichain = require("multichain-node")({
port: globalConfig.connection.port,
host: globalConfig.connection.host,
user: globalConfig.connection.user,
pass: globalConfig.connection.pass,
});
multichain.getInfo((err, info) => {
if(err){
throw err;
}
JSON.stringify(info);
console.log(info);
global.x = (info);
});
var mainWindow = null
app.on('ready', function () {
mainWindow = new BrowserWindow({
title: config.productName,
backgroundColor: '#333333',
webPreferences: {
nodeIntegration: true,
defaultEncoding: 'UTF-8'
}
})
mainWindow.loadURL(`file://${__dirname}/app/new-index.html`)
var introJS = require('intro.js').introJs
// Enable keyboard shortcuts for Developer Tools on various platforms.
let platform = os.platform()
if (platform === 'darwin') {
globalShortcut.register('Command+Option+I', () => {
mainWindow.webContents.openDevTools()
})
} else if (platform === 'linux' || platform === 'win32') {
globalShortcut.register('Control+Shift+I', () => {
mainWindow.webContents.openDevTools()
})
}
mainWindow.once('ready-to-show', () => {
mainWindow.setMenu(null)
mainWindow.show()
})
mainWindow.onbeforeunload = (e) => {
// Prevent Command-R from unloading the window contents.
e.returnValue = false
}
mainWindow.on('closed', function () {
mainWindow = null
})
})
app.on('window-all-closed', () => { app.quit() })