-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.js
29 lines (21 loc) · 933 Bytes
/
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
import hotkeyManager from './lib/hotkeyManager.js';
import pageWorkerManager from './lib/pageWorkerManager.js';
import CommandOptions from './options/CommandOptions.js';
import ContentScriptOptions from './options/ContentScriptOptions.js';
import isFirefoxPromise from '../lib/isFirefoxPromise.js'
pageWorkerManager.Init();
function onPrefChange(storageChange) { //re-register content scripts
hotkeyManager.UnregisterHotkeys();
pageWorkerManager.Destroy();
// Handle changes
if (storageChange.contentScripts)
ContentScriptOptions.activate(storageChange.contentScripts.newValue);
if (storageChange.commands)
CommandOptions.activate(storageChange.commands.newValue);
pageWorkerManager.Init();
}
browser.storage.onChanged.addListener(onPrefChange);
new ContentScriptOptions().activate();
isFirefoxPromise.then(isFirefox => {
if (isFirefox) new CommandOptions().activate();
});