-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
31 lines (26 loc) · 793 Bytes
/
Copy pathbackground.js
File metadata and controls
31 lines (26 loc) · 793 Bytes
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
/* Space Control - keeps the chrome side in sync with the stored settings. */
const DEFAULTS = {
addressbook: true,
calendar: true,
tasks: true,
chat: true,
};
async function readConfig() {
const { spaces } = await browser.storage.local.get({ spaces: DEFAULTS });
return { ...DEFAULTS, ...spaces };
}
async function applyStoredConfig() {
try {
await browser.spaceControl.apply(await readConfig());
} catch (error) {
// Most likely cause: the experiment API did not load, which means
// extensions.experiments.enabled is off.
console.error("Space Control could not apply its settings:", error);
}
}
browser.storage.onChanged.addListener((changes, area) => {
if (area == "local" && changes.spaces) {
applyStoredConfig();
}
});
applyStoredConfig();