diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2019-05-22 20:16:21 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-22 20:16:21 +0900 |
commit | c1f64927b63d18048790abd3ba907083dbca3084 (patch) | |
tree | 3a64b677763f62094c49527d8182f8756a52fbd1 /src/background/usecases/CompletionsUseCase.ts | |
parent | ced89134e32d793d8e091113cfb20867e1c3b572 (diff) | |
parent | 7be8bc71784b8dedd0fee03dd72dd8936e2f3929 (diff) |
Merge pull request #588 from ueokande/tsyringe
Use tsyringe for DI container
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[]> { |