-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.js
More file actions
19 lines (19 loc) · 729 Bytes
/
config.js
File metadata and controls
19 lines (19 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"use strict";
let DOTPAGEMOD_PATH = "";
const reloadConfigDirectory = r => {
DOTPAGEMOD_PATH = r.configdir;
if (r.configdir)
port.postMessage({cmd: 'list', path: r.configdir});
else {
browser.tabs.create({'active': true, 'url': '/pages/noconfig.html'});
console.error("No configuration directory set, so it can't be reloaded");
}
};
const getAndReloadConfigDirectory = () => {
return browser.storage.local.get("configdir").then(reloadConfigDirectory,
e => console.error("Reloading fails because we couldn't get the configuration directory", e));
};
browser.storage.onChanged.addListener(changes => {
if (changes.hasOwnProperty('configdir'))
reloadConfigDirectory({ 'configdir': changes.configdir.newValue });
});