diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-28 10:51:52 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2018-07-28 14:20:29 +0900 |
commit | ccdb0a2428bbdc56e8288442f844a4bb3b8f9a11 (patch) | |
tree | c1d653b3792917473bace600d12a071b35f6168c /src/background/components/indicator.js | |
parent | 66c23423f931bb66c59cd29cf9279a5de5d56535 (diff) |
Clean old codes
Diffstat (limited to 'src/background/components/indicator.js')
-rw-r--r-- | src/background/components/indicator.js | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/background/components/indicator.js b/src/background/components/indicator.js deleted file mode 100644 index 1ded329..0000000 --- a/src/background/components/indicator.js +++ /dev/null @@ -1,43 +0,0 @@ -import * as indicators from '../shared/indicators'; -import messages from 'shared/messages'; - -export default class IndicatorComponent { - constructor(store) { - this.store = store; - - messages.onMessage(this.onMessage.bind(this)); - - browser.browserAction.onClicked.addListener(this.onClicked); - browser.tabs.onActivated.addListener(async(info) => { - await browser.tabs.query({ currentWindow: true }); - return this.onTabActivated(info); - }); - } - - async onTabActivated(info) { - let { enabled } = await browser.tabs.sendMessage(info.tabId, { - type: messages.ADDON_ENABLED_QUERY, - }); - return this.updateIndicator(enabled); - } - - onClicked(tab) { - browser.tabs.sendMessage(tab.id, { - type: messages.ADDON_TOGGLE_ENABLED, - }); - } - - onMessage(message) { - switch (message.type) { - case messages.ADDON_ENABLED_RESPONSE: - return this.updateIndicator(message.enabled); - } - } - - updateIndicator(enabled) { - if (enabled) { - return indicators.enable(); - } - return indicators.disable(); - } -} |