diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-19 21:34:08 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-19 21:34:08 +0900 |
commit | cdfd54ed99087dc4a7a3fd13865849ff9ce9e8ba (patch) | |
tree | ca18790151d4e6cf003367f0dd87c27371d2b2c8 /src/background/usecases/CompletionsUseCase.ts | |
parent | c7803e7c2911f63e43611290b996f526c0f8aaf2 (diff) |
Use TSyringe on background script
Diffstat (limited to 'src/background/usecases/CompletionsUseCase.ts')
-rw-r--r-- | src/background/usecases/CompletionsUseCase.ts | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/background/usecases/CompletionsUseCase.ts b/src/background/usecases/CompletionsUseCase.ts index da36e3c..705555b 100644 --- a/src/background/usecases/CompletionsUseCase.ts +++ b/src/background/usecases/CompletionsUseCase.ts @@ -1,3 +1,4 @@ +import { injectable } from 'tsyringe'; import CompletionGroup from '../domains/CompletionGroup'; import CommandDocs from '../domains/CommandDocs'; import CompletionsRepository from '../repositories/CompletionsRepository'; @@ -11,17 +12,13 @@ const COMPLETION_ITEM_LIMIT = 10; type Tab = browser.tabs.Tab; type HistoryItem = browser.history.HistoryItem; +@injectable() export default class CompletionsUseCase { - private tabPresenter: TabPresenter; - - private completionsRepository: CompletionsRepository; - - private settingRepository: SettingRepository; - - constructor() { - this.tabPresenter = new TabPresenter(); - this.completionsRepository = new CompletionsRepository(); - this.settingRepository = new SettingRepository(); + constructor( + private tabPresenter: TabPresenter, + private completionsRepository: CompletionsRepository, + private settingRepository: SettingRepository, + ) { } queryConsoleCommand(prefix: string): Promise<CompletionGroup[]> { |