aboutsummaryrefslogtreecommitdiff
path: root/src/content/components/common/keymapper.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-05-10 22:27:20 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-05-10 23:00:59 +0900
commite76ca380f733b515c31297a285d8bea44e074a1b (patch)
treeb476d9ca41a8bbbcbbad3b3ee13882da9d640d25 /src/content/components/common/keymapper.ts
parent05ef6a8ca35aaa801c11eb6b4896caa3690058af (diff)
Make addon-enabled as a clean architecture
Diffstat (limited to 'src/content/components/common/keymapper.ts')
-rw-r--r--src/content/components/common/keymapper.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/content/components/common/keymapper.ts b/src/content/components/common/keymapper.ts
index c94bae0..02579ec 100644
--- a/src/content/components/common/keymapper.ts
+++ b/src/content/components/common/keymapper.ts
@@ -3,6 +3,10 @@ import * as operationActions from '../../actions/operation';
import * as operations from '../../../shared/operations';
import * as keyUtils from '../../../shared/utils/keys';
+import AddonEnabledUseCase from '../../usecases/AddonEnabledUseCase';
+
+let addonEnabledUseCase = new AddonEnabledUseCase();
+
const mapStartsWith = (
mapping: keyUtils.Key[],
keys: keyUtils.Key[],
@@ -41,7 +45,7 @@ export default class KeymapperComponent {
(mapping: keyUtils.Key[]) => {
return mapStartsWith(mapping, input.keys);
});
- if (!state.addon.enabled) {
+ if (!addonEnabledUseCase.getEnabled()) {
// available keymaps are only ADDON_ENABLE and ADDON_TOGGLE_ENABLED if
// the addon disabled
matched = matched.filter((keys) => {
@@ -59,7 +63,7 @@ export default class KeymapperComponent {
}
let operation = keymaps.get(matched[0]) as operations.Operation;
let act = operationActions.exec(
- operation, state.setting, state.addon.enabled
+ operation, state.setting,
);
this.store.dispatch(act);
this.store.dispatch(inputActions.clearKeys());