diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-10 22:27:20 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-10 23:00:59 +0900 |
commit | e76ca380f733b515c31297a285d8bea44e074a1b (patch) | |
tree | b476d9ca41a8bbbcbbad3b3ee13882da9d640d25 /src/content/components/top-content/index.ts | |
parent | 05ef6a8ca35aaa801c11eb6b4896caa3690058af (diff) |
Make addon-enabled as a clean architecture
Diffstat (limited to 'src/content/components/top-content/index.ts')
-rw-r--r-- | src/content/components/top-content/index.ts | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/content/components/top-content/index.ts b/src/content/components/top-content/index.ts index ac95ea9..101edca 100644 --- a/src/content/components/top-content/index.ts +++ b/src/content/components/top-content/index.ts @@ -5,15 +5,15 @@ import * as consoleFrames from '../../console-frames'; import * as messages from '../../../shared/messages'; import MessageListener from '../../MessageListener'; import * as scrolls from '../../scrolls'; +import AddonEnabledUseCase from '../../usecases/AddonEnabledUseCase'; + +let addonEnabledUseCase = new AddonEnabledUseCase(); export default class TopContent { private win: Window; - private store: any; - constructor(win: Window, store: any) { this.win = win; - this.store = store; new CommonComponent(win, store); // eslint-disable-line no-new new FollowController(win, store); // eslint-disable-line no-new @@ -36,14 +36,11 @@ export default class TopContent { } onBackgroundMessage(message: messages.Message) { - let addonState = this.store.getState().addon; + let addonEnabled = addonEnabledUseCase.getEnabled(); switch (message.type) { case messages.ADDON_ENABLED_QUERY: - return Promise.resolve({ - type: messages.ADDON_ENABLED_RESPONSE, - enabled: addonState.enabled, - }); + return Promise.resolve(addonEnabled); case messages.TAB_SCROLL_TO: return scrolls.scrollTo(message.x, message.y, false); } |