-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
52 lines (45 loc) · 1.1 KB
/
main.js
File metadata and controls
52 lines (45 loc) · 1.1 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
/*
Shuangyi Tong <shuangyi.tong@eng.ox.ac.uk>
created on Apr 15, 2021
*/
const { app, BrowserWindow } = require('electron');
let { env } = require('./backend/env.js');
require('./backend/server.js')
require('./backend/service.js')
function createWindow () {
const win = new BrowserWindow({
width: 1920,
height: 1080,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
win.on('close', function(e) {
const choice = require('electron').dialog.showMessageBoxSync(this,
{
type: 'question',
buttons: ['Yes, I can confirm I saved all the data, close it NOW', 'Oh, No!!!!!!'],
title: 'Confirm',
message: 'DID YOU SAVED THE DATA?????????????????'
});
if (choice === 1) {
e.preventDefault();
}
});
env.winRef = win;
win.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})