-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
53 lines (43 loc) · 1.34 KB
/
main.js
File metadata and controls
53 lines (43 loc) · 1.34 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
const { app, BrowserWindow, ipcMain } = require('electron');
const { settings, parseMastery } = require('./js/ipcMain.js');
exports.createMainWindow = function () {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
minHeight: 600,
maxHeight: 1200,
minWidth: 800,
maxWidth: 800,
frame: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
title: 'Mastery Checker',
});
mainWindow.loadFile('./html/index.html');
// Open the DevTools.
//mainWindow.webContents.openDevTools()
return mainWindow;
};
app.whenReady().then(async () => {
const mainWindow = exports.createMainWindow();
await settings.load();
setTimeout(async () => {
const nickName = settings.get('summoner');
if (nickName) await parseMastery(nickName);
const findChamp = settings.get('findChamp');
if (findChamp) mainWindow.webContents.send('filterChampList', findChamp);
}, 500);
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) exports.createMainWindow();
});
});
app.on('window-all-closed', async function () {
if (process.platform !== 'darwin') {
await settings.save();
app.quit();
}
});