-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
62 lines (43 loc) · 1.73 KB
/
index.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
const { app, ipcMain } = require('electron');
if (require('electron-squirrel-startup')) app.quit();
const logger = require('./src/utils/logManager.js');
const configManager = require('./src/utils/configManager.js');
/**
* @param {String} first - opicional, informa se é a primeira execução do programa ou não
*/
async function setup(first) {
await configManager.setupConfig();
const updater = require('./src/utils/updateManager.js');
if(first) await updater.checkUpdates();
const localeManager = require('./src/utils/localeManager.js')
await localeManager.setupLocales();
const keyManager = require('./src/utils/keyManager.js');
keyManager.setupKeybinds();
const trayManager = require('./src/utils/trayManager.js')
trayManager.createTrayIcon();
if(first) logger.write('utils', 'main > setup', 'INICIALIZACAO CONCLUIDA');
}
// function loop() {
// setInterval(() => {
// //if (!cache.pauseReading()) {
// // mouseManager.getMousePosition(true)
// //}
// }, configManager.config.loopdelay);
// }
ipcMain.on('request-config', (event) => {
logger.write('config','IPC > request-config', "O front end requisitou as configuraç~eos");
event.reply('config-response', configManager.getConfig());
});
ipcMain.on('update-settings', (event, { keybinds, clickPositions }) => {
logger.write('config','IPC > update-settings', JSON.stringify({ keybinds, clickPositions }));
configManager.updateToFile('keybinds', keybinds);
configManager.updateToFile('clickPositions', clickPositions);
setup();
});
app.on('ready', () => {
setup('first');
//loop();
});
module.exports = {
setup
}