-
Notifications
You must be signed in to change notification settings - Fork 2
/
options.js
executable file
·45 lines (25 loc) · 950 Bytes
/
options.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
async function get_settings_local()
{
return ( await browser.storage.local.get() ) ;
}
async function get_settings_sync()
{
return ( await browser.storage.sync.get() ) ;
}
document.addEventListener("DOMContentLoaded", async function() {
(async () => {
if ( ( await get_settings_local() ) ['notify'] === true)
document.getElementById("checkbox-notify").checked = true;
} ) () ;
(async () => {
document.getElementById("checkbox-notify").addEventListener("change", async function (event) {
if (event.target.checked)
console.log(
await browser.permissions.request( { permissions: ['notifications'] } )
);
await browser.storage.local.set({
"notify": document.getElementById("checkbox-notify").checked
});
});
} ) () ;
} ) ;