diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-05-06 22:47:58 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-05-06 22:47:58 +0900 |
commit | 6d057a974bb42406259b6f0b0a8c0b1e22335073 (patch) | |
tree | 9a299d7f54e141eb2b851bbca787007ce533df92 /src/background/components | |
parent | 129aae38df1a17a5850898d5832bb8112ead3cbb (diff) |
Toggle add-on enabled by clicking indicator
Diffstat (limited to 'src/background/components')
-rw-r--r-- | src/background/components/indicator.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/background/components/indicator.js b/src/background/components/indicator.js index ccdcc74..cceb119 100644 --- a/src/background/components/indicator.js +++ b/src/background/components/indicator.js @@ -7,6 +7,7 @@ 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); @@ -22,6 +23,12 @@ export default class IndicatorComponent { }); } + onClicked(tab) { + browser.tabs.sendMessage(tab.id, { + type: messages.ADDON_TOGGLE_ENABLED, + }); + } + onMessage(message) { switch (message.type) { case messages.ADDON_ENABLED_RESPONSE: |