diff options
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, }); } } |