-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrenderer.js
31 lines (23 loc) · 854 Bytes
/
renderer.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
const remote = require('electron').remote
const Store = require('electron-store');
const store = new Store()
const authButton = document.getElementById('auth_button');
const notificationsToggle = document.getElementById('toggle_notifications');
const notificationsFieldset = document.getElementById('notifications_fieldset');
const auth = remote.getGlobal('auth')
const isAuthed = remote.getGlobal('isAuthed')
authButton.addEventListener('click', function () {
auth()
});
notificationsToggle.addEventListener('change', function () {
if (this.checked == true) {
store.set('notifications?', 'on')
} else {
store.set('notifications?', 'off')
}
})
isAuthed.then((bool) => {
const isOn = store.get('notifications?')
if (bool) notificationsFieldset.disabled = false
if (bool && isOn == "on") notificationsToggle.checked = true
})