summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/backend.js2
-rw-r--r--ext/fg/js/frontend.js14
2 files changed, 10 insertions, 6 deletions
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index b3e737da..0394c4ec 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -59,7 +59,7 @@ class Backend {
const callback = () => this.checkLastError(chrome.runtime.lastError);
chrome.tabs.query({}, tabs => {
for (const tab of tabs) {
- chrome.tabs.sendMessage(tab.id, {action: 'optionsSet', params: {options}}, callback);
+ chrome.tabs.sendMessage(tab.id, {action: 'optionsUpdate', params: {}}, callback);
}
});
}
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js
index 52620933..83e0cef1 100644
--- a/ext/fg/js/frontend.js
+++ b/ext/fg/js/frontend.js
@@ -261,11 +261,8 @@ class Frontend {
onBgMessage({action, params}, sender, callback) {
const handlers = {
- optionsSet: ({options}) => {
- this.options = options;
- if (!this.options.enable) {
- this.searchClear();
- }
+ optionsUpdate: () => {
+ this.updateOptions();
},
popupSetVisible: ({visible}) => {
@@ -284,6 +281,13 @@ class Frontend {
console.log(error);
}
+ async updateOptions() {
+ this.options = await apiOptionsGet();
+ if (!this.options.enable) {
+ this.searchClear();
+ }
+ }
+
popupTimerSet(callback) {
this.popupTimerClear();
this.popupTimer = window.setTimeout(callback, this.options.scanning.delay);