-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
68 lines (58 loc) · 1.56 KB
/
main.js
File metadata and controls
68 lines (58 loc) · 1.56 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
const {app, BrowserWindow, ipcMain} = require('electron');
const path = require('path');
const url = require('url');
var mainWindow = null;
var repoPath = null;
var initWindow = function () {
mainWindow = new BrowserWindow({
backgroundColor: '#fff',
width: 800,
minWidth: 20,
height: 600,
minHeight: 20,
titleBarStyle: 'customButtonsOnHover',
show: false
});
//mainWindow.webContents.openDevTools();
mainWindow.on('ready-to-show', () => {
mainWindow.show();
});
};
var loadHtmlFile = function (filepath, params) {
if (mainWindow != null) {
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, filepath),
protocol: 'file:',
slashes: true
}));
} else {
console.error('Error: mainWindow not set.');
}
};
var loadWelcome = function (params) {
loadHtmlFile('html/welcome.html', params)
};
var loadDashboard = function (params) {
loadHtmlFile('html/dashboard.html', params);
};
ipcMain.on('setRepoPath', (event, arg) => {
repoPath = arg;
});
ipcMain.on('getRepoPath', (event, arg) => {
event.sender.send('getRepoPath-reply', repoPath);
});
app.on('ready', () => {
initWindow();
// loadHtmlFile('html/welcome.html');
loadWelcome();
// Testing dashboard
//loadDashboard();
});
app.on('window-all-closed', () => {
if (process.platform !== "darwin") {
app.quit();
}
});
exports.loadHtmlFile = loadHtmlFile;
exports.loadWelcome = loadWelcome;
exports.loadDashboard = loadDashboard;