-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
52 lines (42 loc) · 1.13 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
const {
app,
BrowserWindow,
ipcMain
} = require('electron');
const data = require('./data');
let mainWindow = null;
app.on('ready', () => {
mainWindow = new BrowserWindow({
width: 600,
height: 400,
webPreferences: {
nodeIntegration: true
},
});
mainWindow.loadURL(`file://${__dirname}/app/index.html`);
});
app.on('window-all-closed', () => app.quit());
let sobreWindow = null;
ipcMain.on('abrir-janela-sobre', () => {
if (!sobreWindow) {
sobreWindow = new BrowserWindow({
width: 300,
height: 230,
alwaysOnTop: true,
frame: false,
resizable: false,
webPreferences: {
nodeIntegration: true
},
});
sobreWindow.loadURL(`file://${__dirname}/app/sobre.html`);
sobreWindow.on('closed', () => {
sobreWindow = null;
})
}
});
ipcMain.on('fechar-janela-sobre', () => sobreWindow.close());
ipcMain.on('curso-parado', (event, curso, tempoEstudo) => {
console.log(curso, tempoEstudo);
data.salvarDados(curso, tempoEstudo);
});