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/content/usecases/ClipboardUseCase.ts | |
parent | ced89134e32d793d8e091113cfb20867e1c3b572 (diff) | |
parent | 7be8bc71784b8dedd0fee03dd72dd8936e2f3929 (diff) |
Merge pull request #588 from ueokande/tsyringe
Use tsyringe for DI container
Diffstat (limited to 'src/content/usecases/ClipboardUseCase.ts')
-rw-r--r-- | src/content/usecases/ClipboardUseCase.ts | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/src/content/usecases/ClipboardUseCase.ts b/src/content/usecases/ClipboardUseCase.ts index b2ece2f..8c4d621 100644 --- a/src/content/usecases/ClipboardUseCase.ts +++ b/src/content/usecases/ClipboardUseCase.ts @@ -1,31 +1,18 @@ +import { injectable, inject } from 'tsyringe'; import * as urls from '../../shared/urls'; -import ClipboardRepository, { ClipboardRepositoryImpl } - from '../repositories/ClipboardRepository'; -import SettingRepository, { SettingRepositoryImpl } - from '../repositories/SettingRepository'; -import TabsClient, { TabsClientImpl } - from '../client/TabsClient'; -import ConsoleClient, { ConsoleClientImpl } from '../client/ConsoleClient'; +import ClipboardRepository from '../repositories/ClipboardRepository'; +import SettingRepository from '../repositories/SettingRepository'; +import TabsClient from '../client/TabsClient'; +import ConsoleClient from '../client/ConsoleClient'; +@injectable() export default class ClipboardUseCase { - private repository: ClipboardRepository; - - private settingRepository: SettingRepository; - - private client: TabsClient; - - private consoleClient: ConsoleClient; - - constructor({ - repository = new ClipboardRepositoryImpl(), - settingRepository = new SettingRepositoryImpl(), - client = new TabsClientImpl(), - consoleClient = new ConsoleClientImpl(), - } = {}) { - this.repository = repository; - this.settingRepository = settingRepository; - this.client = client; - this.consoleClient = consoleClient; + constructor( + @inject('ClipboardRepository') private repository: ClipboardRepository, + @inject('SettingRepository') private settingRepository: SettingRepository, + @inject('TabsClient') private client: TabsClient, + @inject('ConsoleClient') private consoleClient: ConsoleClient, + ) { } async yankCurrentURL(): Promise<string> { |