aboutsummaryrefslogtreecommitdiff
path: root/src/content/components/common/index.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-05-19 09:34:40 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-05-19 09:34:40 +0900
commit4be04628e19392d8da9688d538cc3374e91005d8 (patch)
tree5c2299f6b85bf96dc9df65ddd7c27aef01b0ed69 /src/content/components/common/index.ts
parente0c4182f14f908d13c8c814c7bc2b48a1791f881 (diff)
Remove unused components
Diffstat (limited to 'src/content/components/common/index.ts')
-rw-r--r--src/content/components/common/index.ts59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/content/components/common/index.ts b/src/content/components/common/index.ts
deleted file mode 100644
index 1aacf51..0000000
--- a/src/content/components/common/index.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import InputDriver from './../../InputDriver';
-import FollowComponent from './follow';
-import MarkComponent from './mark';
-// import KeymapperComponent from './keymapper';
-import * as messages from '../../../shared/messages';
-import MessageListener from '../../MessageListener';
-import * as blacklists from '../../../shared/blacklists';
-import Key from '../../domains/Key';
-
-import AddonEnabledUseCase from '../../usecases/AddonEnabledUseCase';
-import SettingUseCase from '../../usecases/SettingUseCase';
-
-let addonEnabledUseCase = new AddonEnabledUseCase();
-let settingUseCase = new SettingUseCase();
-
-export default class Common {
- constructor(win: Window, store: any) {
- const input = new InputDriver(win.document.body);
- const follow = new FollowComponent();
- const mark = new MarkComponent(store);
- // const keymapper = new KeymapperComponent(store);
-
- input.onKey((key: Key) => follow.key(key));
- input.onKey((key: Key) => mark.key(key));
- // input.onKey((key: Key) => keymapper.key(key));
-
- this.reloadSettings();
-
- new MessageListener().onBackgroundMessage(this.onMessage.bind(this));
- }
-
- onMessage(message: messages.Message) {
- switch (message.type) {
- case messages.SETTINGS_CHANGED:
- return this.reloadSettings();
- case messages.ADDON_TOGGLE_ENABLED:
- return addonEnabledUseCase.toggle();
- }
- return undefined;
- }
-
- async reloadSettings() {
- try {
- let current = await settingUseCase.reload();
- let disabled = blacklists.includes(
- current.blacklist, window.location.href,
- );
- if (disabled) {
- addonEnabledUseCase.disable();
- } else {
- addonEnabledUseCase.enable();
- }
- } catch (e) {
- // Sometime sendMessage fails when background script is not ready.
- console.warn(e);
- setTimeout(() => this.reloadSettings(), 500);
- }
- }
-}