aboutsummaryrefslogtreecommitdiff
path: root/src/background/components/indicator.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-06-17 20:21:39 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-06-17 21:55:25 +0900
commit48e4bccf0d24bb6ce53c4ecea567ed7750fe8949 (patch)
tree7c16a68489f2894564da18ae059ba492db88907a /src/background/components/indicator.js
parent88238005ab64f957d9def8c18473d8210b280de9 (diff)
Use async/await on background
Diffstat (limited to 'src/background/components/indicator.js')
-rw-r--r--src/background/components/indicator.js14
1 files changed, 6 insertions, 8 deletions
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) {