-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
78 lines (61 loc) · 1.6 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
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
76
77
78
// main process
const {app, BrowserWindow, ipcMain} = require('electron');
const path = require('path');
const url = require('url');
let mainWindow;
let aboutWindow;
function createWindow() {
mainWindow = new BrowserWindow({
width: 850,
height: 400,
title: 'BellCurve',
resizable: false,
frame: false,
show: false,
icon: path.join(__dirname, 'assets/icons/png/64x64.png')
});
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'main.html'),
protocol: 'file',
slashes: true
}));
mainWindow.setMenu(null);
//mainWindow.webContents.openDevTools();
mainWindow.on('closed', function() {
mainWindow = null;
if (aboutWindow) {
aboutWindow.close();
}
});
mainWindow.on('ready-to-show', function() {
mainWindow.show();
});
}
function launchCredits() {
if (!aboutWindow) {
aboutWindow = new BrowserWindow({
width: 475,
height: 500,
alwaysOnTop: true,
resizable: false,
fullscreenable: false,
title: 'About BellCurve'
});
}
aboutWindow.loadURL(url.format({
pathname: path.join(__dirname, 'about.html'),
protocol: 'file',
slashes: true
}));
aboutWindow.setMenu(null);
aboutWindow.on('closed', function() {
aboutWindow = null;
});
}
app.on('ready', createWindow);
ipcMain.on('show-about', function(event, arg) {
launchCredits();
});
ipcMain.on('close-app', function(event, arg) {
mainWindow.close();
});