aboutsummaryrefslogtreecommitdiff
path: root/src/background/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/background/components')
-rw-r--r--src/background/components/background.js15
-rw-r--r--src/background/components/indicator.js14
-rw-r--r--src/background/components/tab.js7
3 files changed, 16 insertions, 20 deletions
diff --git a/src/background/components/background.js b/src/background/components/background.js
index 29124a6..c7a79a1 100644
--- a/src/background/components/background.js
+++ b/src/background/components/background.js
@@ -56,13 +56,12 @@ export default class BackgroundComponent {
}
}
- broadcastSettingsChanged() {
- return browser.tabs.query({}).then((tabs) => {
- for (let tab of tabs) {
- browser.tabs.sendMessage(tab.id, {
- type: messages.SETTINGS_CHANGED,
- });
- }
- });
+ async broadcastSettingsChanged() {
+ let tabs = await browser.tabs.query({});
+ for (let tab of tabs) {
+ browser.tabs.sendMessage(tab.id, {
+ type: messages.SETTINGS_CHANGED,
+ });
+ }
}
}
diff --git a/src/background/components/indicator.js b/src/background/components/indicator.js
index cceb119..1ded329 100644
--- a/src/background/components/indicator.js
+++ b/src/background/components/indicator.js
@@ -8,19 +8,17 @@ export default class IndicatorComponent {
messages.onMessage(this.onMessage.bind(this));
browser.browserAction.onClicked.addListener(this.onClicked);
- browser.tabs.onActivated.addListener((info) => {
- return browser.tabs.query({ currentWindow: true }).then(() => {
- return this.onTabActivated(info);
- });
+ browser.tabs.onActivated.addListener(async(info) => {
+ await browser.tabs.query({ currentWindow: true });
+ return this.onTabActivated(info);
});
}
- onTabActivated(info) {
- return browser.tabs.sendMessage(info.tabId, {
+ async onTabActivated(info) {
+ let { enabled } = await browser.tabs.sendMessage(info.tabId, {
type: messages.ADDON_ENABLED_QUERY,
- }).then((resp) => {
- return this.updateIndicator(resp.enabled);
});
+ return this.updateIndicator(enabled);
}
onClicked(tab) {
diff --git a/src/background/components/tab.js b/src/background/components/tab.js
index b273546..6af3fd7 100644
--- a/src/background/components/tab.js
+++ b/src/background/components/tab.js
@@ -4,10 +4,9 @@ export default class TabComponent {
constructor(store) {
this.store = store;
- browser.tabs.onActivated.addListener((info) => {
- return browser.tabs.query({ currentWindow: true }).then(() => {
- return this.onTabActivated(info);
- });
+ browser.tabs.onActivated.addListener(async(info) => {
+ await browser.tabs.query({ currentWindow: true });
+ return this.onTabActivated(info);
});
}