-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
40 lines (31 loc) · 1.16 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
const ipc = require('electron').ipcRenderer;
var shell = require('electron').shell
const DEFAULT_INTERVAL = 30;
const exitBtn = document.getElementById('exit-btn');
const stressBtn = document.getElementById('stress-btn');
const aboutBtn = document.getElementById('about-btn');
const intervalBtn = document.getElementById('interval-btn');
exitBtn.addEventListener('click', () => {
ipc.send('closeApp');
});
stressBtn.addEventListener('click', () => {
ipc.send('showMessage');
});
aboutBtn.addEventListener('click', () => {
shell.openExternal("https://github.com/gauravchl/halo");
});
intervalBtn.addEventListener('input', (e) => {
const min = e.target.value;
ipc.send('updateInterval', parseInt(min));
updateIntervalText(min);
});
const updateIntervalText = min => {
const time = min >= 60 ? `${min/60} hour` : `${min}min`;
const text = `whop whop in every ${time}`
document.getElementById('interval-label').innerText = text;
}
// Set interval from storage
const initialInterval = ipc.sendSync('getInterval') || DEFAULT_INTERVAL;
updateIntervalText(initialInterval)
intervalBtn.value = initialInterval;
console.log("#GC - initialInterval", initialInterval)