diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-05-02 17:25:56 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-02 17:25:56 +0900 |
commit | 5df0537bcf65a341e79852b1b30379c73318529c (patch) | |
tree | aee5efe52412855f620cb514a13a2c14373f27b7 /src/background/usecases/MarkUseCase.ts | |
parent | 685f2b7b69218b06b5bb676069e35f79c5048c9b (diff) | |
parent | 75abd90ecb8201ad845b266f96220d8adfe19b2d (diff) |
Merge pull request #749 from ueokande/qa-0.28
QA 0.28
Diffstat (limited to 'src/background/usecases/MarkUseCase.ts')
-rw-r--r-- | src/background/usecases/MarkUseCase.ts | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/background/usecases/MarkUseCase.ts b/src/background/usecases/MarkUseCase.ts index 2c0bc13..9da9a21 100644 --- a/src/background/usecases/MarkUseCase.ts +++ b/src/background/usecases/MarkUseCase.ts @@ -1,18 +1,17 @@ -import { inject, injectable } from 'tsyringe'; -import TabPresenter from '../presenters/TabPresenter'; -import MarkRepository from '../repositories/MarkRepository'; -import ConsoleClient from '../infrastructures/ConsoleClient'; -import ContentMessageClient from '../infrastructures/ContentMessageClient'; +import { inject, injectable } from "tsyringe"; +import TabPresenter from "../presenters/TabPresenter"; +import MarkRepository from "../repositories/MarkRepository"; +import ConsoleClient from "../infrastructures/ConsoleClient"; +import ContentMessageClient from "../infrastructures/ContentMessageClient"; @injectable() export default class MarkUseCase { constructor( - @inject('TabPresenter') private tabPresenter: TabPresenter, + @inject("TabPresenter") private tabPresenter: TabPresenter, private markRepository: MarkRepository, private consoleClient: ConsoleClient, - private contentMessageClient: ContentMessageClient, - ) { - } + private contentMessageClient: ContentMessageClient + ) {} async setGlobal(key: string, x: number, y: number): Promise<any> { const tab = await this.tabPresenter.getCurrent(); @@ -26,7 +25,9 @@ export default class MarkUseCase { const mark = await this.markRepository.getMark(key); if (!mark) { return this.consoleClient.showError( - current.id as number, 'Mark is not set'); + current.id as number, + "Mark is not set" + ); } try { await this.contentMessageClient.scrollTo(mark.tabId, mark.x, mark.y); @@ -34,7 +35,10 @@ export default class MarkUseCase { } catch (e) { const tab = await this.tabPresenter.create(mark.url); return this.markRepository.setMark(key, { - tabId: tab.id as number, url: mark.url, x: mark.x, y: mark.y, + tabId: tab.id as number, + url: mark.url, + x: mark.x, + y: mark.y, }); } } |