diff options
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/client/OperationClient.ts (renamed from src/content/client/BackgroundClient.ts) | 8 | ||||
-rw-r--r-- | src/content/controllers/KeymapController.ts | 6 | ||||
-rw-r--r-- | src/content/di.ts | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src/content/client/BackgroundClient.ts b/src/content/client/OperationClient.ts index 4a41184..d699fec 100644 --- a/src/content/client/BackgroundClient.ts +++ b/src/content/client/OperationClient.ts @@ -1,9 +1,11 @@ -import { injectable } from 'tsyringe'; import * as operations from '../../shared/operations'; import * as messages from '../../shared/messages'; -@injectable() -export default class BackgroundClient { +export default interface OperationClient { + execBackgroundOp(op: operations.Operation): Promise<void>; +} + +export class OperationClientImpl implements OperationClient { execBackgroundOp(op: operations.Operation): Promise<void> { return browser.runtime.sendMessage({ type: messages.BACKGROUND_OPERATION, diff --git a/src/content/controllers/KeymapController.ts b/src/content/controllers/KeymapController.ts index 4eb6955..fcfaff1 100644 --- a/src/content/controllers/KeymapController.ts +++ b/src/content/controllers/KeymapController.ts @@ -6,7 +6,7 @@ import FindSlaveUseCase from '../usecases/FindSlaveUseCase'; import ScrollUseCase from '../usecases/ScrollUseCase'; import FocusUseCase from '../usecases/FocusUseCase'; import ClipboardUseCase from '../usecases/ClipboardUseCase'; -import BackgroundClient from '../client/BackgroundClient'; +import OperationClient from '../client/OperationClient'; import MarkKeyyUseCase from '../usecases/MarkKeyUseCase'; import FollowMasterClient from '../client/FollowMasterClient'; import Key from '../domains/Key'; @@ -20,9 +20,11 @@ export default class KeymapController { private scrollUseCase: ScrollUseCase, private focusUseCase: FocusUseCase, private clipbaordUseCase: ClipboardUseCase, - private backgroundClient: BackgroundClient, private markKeyUseCase: MarkKeyyUseCase, + @inject('OperationClient') + private backgroundClient: OperationClient, + @inject('FollowMasterClient') private followMasterClient: FollowMasterClient, ) { diff --git a/src/content/di.ts b/src/content/di.ts index 23be027..e18806a 100644 --- a/src/content/di.ts +++ b/src/content/di.ts @@ -21,6 +21,7 @@ import { MarkClientImpl } from './client/MarkClient'; import { MarkKeyRepositoryImpl } from './repositories/MarkKeyRepository'; import { MarkRepositoryImpl } from './repositories/MarkRepository'; import { NavigationPresenterImpl } from './presenters/NavigationPresenter'; +import { OperationClientImpl } from './client/OperationClient'; import { ScrollPresenterImpl } from './presenters/ScrollPresenter'; import { SettingClientImpl } from './client/SettingClient'; import { SettingRepositoryImpl } from './repositories/SettingRepository'; @@ -48,6 +49,7 @@ container.register('MarkClient', { useClass: MarkClientImpl }); container.register('MarkKeyRepository', { useClass: MarkKeyRepositoryImpl }); container.register('MarkRepository', { useClass: MarkRepositoryImpl }); container.register('NavigationPresenter', { useClass: NavigationPresenterImpl }); +container.register('OperationClient', { useClass: OperationClientImpl }); container.register('ScrollPresenter', { useClass: ScrollPresenterImpl }); container.register('SettingClient', { useClass: SettingClientImpl }); container.register('SettingRepository', { useClass: SettingRepositoryImpl }); |