forked from RattlesHyper/TrafficerMC
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
38 lines (33 loc) · 1005 Bytes
/
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
const { app, ipcMain, BrowserWindow, ipcRenderer } = require('electron')
const window = require('./assets/js/window')
const Store = require('electron-store');
const store = new Store();
app.disableHardwareAcceleration()
app.whenReady().then(() => {
createWindow()
app.focus()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
function createWindow() {
const mainWindow = new window({
file: "index.html"
});
ipcMain.on('minimize', () => {
mainWindow.minimize()
});
mainWindow.webContents.once('dom-ready', () => {
mainWindow.webContents.send('restore', store.get('config'))
mainWindow.webContents.send('restoreTheme', store.get('theme'))
});
mainWindow.webContents.setBackgroundThrottling(false)
}
ipcMain.on('config', (event, config) => {
store.set('config', config)
});
ipcMain.on('theme', (event, path) => {
store.set('theme', path)
});