-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
41 lines (36 loc) · 1.07 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
const { app, BrowserWindow, dialog, ipcMain } = require('electron');
const electron = require("electron");
const MenuItem = electron.MenuItem;
const Menu = electron.Menu;
const path = require("path");
const fs = require('fs');
const resourcePath = "";
let win;
function createWindow() {
// Create the browser window.
win = new BrowserWindow({
width: 800, height: 600,
frame: false,
resizable: false,
alwaysOnTop: true,
transparent: true,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
// and load the index.html of the app.
win.loadFile('main.html')
}
ipcMain.on('open-dialog', function (event, options) {
event.returnValue = dialog.showOpenDialogSync(BrowserWindow.getFocusedWindow(), options);
});
ipcMain.on('get-history', function (event) {
var data = fs.readFileSync(resourcePath + "history.json");
data = JSON.parse(data);
event.returnValue = data;
});
app.on('ready', function () {
setTimeout(function () {
createWindow();
}, 1000);
});