aboutsummaryrefslogtreecommitdiff
path: root/src/content/usecases/KeymapUseCase.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/usecases/KeymapUseCase.ts')
-rw-r--r--src/content/usecases/KeymapUseCase.ts33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/content/usecases/KeymapUseCase.ts b/src/content/usecases/KeymapUseCase.ts
index af0ad77..d0d039a 100644
--- a/src/content/usecases/KeymapUseCase.ts
+++ b/src/content/usecases/KeymapUseCase.ts
@@ -1,10 +1,7 @@
-import KeymapRepository, { KeymapRepositoryImpl }
- from '../repositories/KeymapRepository';
-import SettingRepository, { SettingRepositoryImpl }
- from '../repositories/SettingRepository';
-import AddonEnabledRepository, { AddonEnabledRepositoryImpl }
- from '../repositories/AddonEnabledRepository';
-
+import { injectable, inject } from 'tsyringe';
+import KeymapRepository from '../repositories/KeymapRepository';
+import SettingRepository from '../repositories/SettingRepository';
+import AddonEnabledRepository from '../repositories/AddonEnabledRepository';
import * as operations from '../../shared/operations';
import { Keymaps } from '../../shared/Settings';
import Key from '../domains/Key';
@@ -17,22 +14,18 @@ const reservedKeymaps: Keymaps = {
'<C-[>': { type: operations.CANCEL },
};
-
+@injectable()
export default class KeymapUseCase {
- private repository: KeymapRepository;
-
- private settingRepository: SettingRepository;
+ constructor(
+ @inject('KeymapRepository')
+ private repository: KeymapRepository,
- private addonEnabledRepository: AddonEnabledRepository;
+ @inject('SettingRepository')
+ private settingRepository: SettingRepository,
- constructor({
- repository = new KeymapRepositoryImpl(),
- settingRepository = new SettingRepositoryImpl(),
- addonEnabledRepository = new AddonEnabledRepositoryImpl(),
- } = {}) {
- this.repository = repository;
- this.settingRepository = settingRepository;
- this.addonEnabledRepository = addonEnabledRepository;
+ @inject('AddonEnabledRepository')
+ private addonEnabledRepository: AddonEnabledRepository,
+ ) {
}
nextOp(key: Key): operations.Operation | null {