Use async/await on background
This commit is contained in:
parent
88238005ab
commit
48e4bccf0d
12 changed files with 273 additions and 316 deletions
|
@ -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) {
|
||||
|
|
Reference in a new issue