This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.js
63 lines (51 loc) · 1.53 KB
/
index.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
//const electron = require('electron');
const url = require('url');
const path = require('path');
var fs = require('fs');
//var sqlite3 = require('sqlite3').verbose();
const {app, BrowserWindow, ipcMain, Menu, MenuItem} = require('electron');
const menu = new Menu()
menu.append(new MenuItem({ label: 'Hello' }))
menu.append(new MenuItem({ type: 'separator' }))
menu.append(new MenuItem({ label: 'Electron', type: 'checkbox', checked: true }))
let mainWindow;
app.on('ready' , function(){
win = new BrowserWindow({
width: 800,
height: 600,
minWidth: 200,
minHeight: 200,
})
win.on('closed', () => {
win = null
});
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}));
ipcMain.on('get-dashboard-url', (event, arg) => {
fs.readFile('./dashboard.txt', 'utf-8', (err, data) => {
event.sender.send('asynchronous-reply', data);
});
});
var graphName = "";
ipcMain.on('Name', (event, arg) => {
graphName = arg;
});
ipcMain.on('importData', (event, arg) => {
fs.readFile(graphName, 'utf-8', (err, data) => {
event.sender.send('responseGraph', data);
});
});
ipcMain.on('exportData', (event, arg) => {
fs.writeFile(graphName, arg)
});
ipcMain.on('show-context-menu', (event, arg) => {
const menu = new Menu();
menu.append(new MenuItem ({
label: 'Item ' + arg,
}));
menu.popup(menu)
});
});