diff options
Diffstat (limited to 'src/content/usecases')
-rw-r--r-- | src/content/usecases/AddonEnabledUseCase.ts | 16 | ||||
-rw-r--r-- | src/content/usecases/ClipboardUseCase.ts | 25 | ||||
-rw-r--r-- | src/content/usecases/ConsoleFrameUseCase.ts | 11 | ||||
-rw-r--r-- | src/content/usecases/FindSlaveUseCase.ts | 9 | ||||
-rw-r--r-- | src/content/usecases/FindUseCase.ts | 31 | ||||
-rw-r--r-- | src/content/usecases/FocusUseCase.ts | 9 | ||||
-rw-r--r-- | src/content/usecases/FollowMasterUseCase.ts | 78 | ||||
-rw-r--r-- | src/content/usecases/FollowSlaveUseCase.ts | 31 | ||||
-rw-r--r-- | src/content/usecases/HintKeyProducer.ts | 7 | ||||
-rw-r--r-- | src/content/usecases/KeymapUseCase.ts | 60 | ||||
-rw-r--r-- | src/content/usecases/MarkKeyUseCase.ts | 9 | ||||
-rw-r--r-- | src/content/usecases/MarkUseCase.ts | 29 | ||||
-rw-r--r-- | src/content/usecases/NavigateUseCase.ts | 11 | ||||
-rw-r--r-- | src/content/usecases/ScrollUseCase.ts | 13 | ||||
-rw-r--r-- | src/content/usecases/SettingUseCase.ts | 15 |
15 files changed, 171 insertions, 183 deletions
diff --git a/src/content/usecases/AddonEnabledUseCase.ts b/src/content/usecases/AddonEnabledUseCase.ts index 608a401..f7e78c5 100644 --- a/src/content/usecases/AddonEnabledUseCase.ts +++ b/src/content/usecases/AddonEnabledUseCase.ts @@ -1,18 +1,16 @@ -import { injectable, inject } from 'tsyringe'; -import AddonIndicatorClient from '../client/AddonIndicatorClient'; -import AddonEnabledRepository from '../repositories/AddonEnabledRepository'; +import { injectable, inject } from "tsyringe"; +import AddonIndicatorClient from "../client/AddonIndicatorClient"; +import AddonEnabledRepository from "../repositories/AddonEnabledRepository"; @injectable() export default class AddonEnabledUseCase { - constructor( - @inject('AddonIndicatorClient') + @inject("AddonIndicatorClient") private indicator: AddonIndicatorClient, - @inject('AddonEnabledRepository') - private repository: AddonEnabledRepository, - ) { - } + @inject("AddonEnabledRepository") + private repository: AddonEnabledRepository + ) {} async enable(): Promise<void> { await this.setEnabled(true); diff --git a/src/content/usecases/ClipboardUseCase.ts b/src/content/usecases/ClipboardUseCase.ts index 7f16f68..875fc11 100644 --- a/src/content/usecases/ClipboardUseCase.ts +++ b/src/content/usecases/ClipboardUseCase.ts @@ -1,24 +1,23 @@ -import { injectable, inject } from 'tsyringe'; -import * as urls from '../../shared/urls'; -import ClipboardRepository from '../repositories/ClipboardRepository'; -import SettingRepository from '../repositories/SettingRepository'; -import ConsoleClient from '../client/ConsoleClient'; -import OperationClient from '../client/OperationClient'; +import { injectable, inject } from "tsyringe"; +import * as urls from "../../shared/urls"; +import ClipboardRepository from "../repositories/ClipboardRepository"; +import SettingRepository from "../repositories/SettingRepository"; +import ConsoleClient from "../client/ConsoleClient"; +import OperationClient from "../client/OperationClient"; @injectable() export default class ClipboardUseCase { constructor( - @inject('ClipboardRepository') private repository: ClipboardRepository, - @inject('SettingRepository') private settingRepository: SettingRepository, - @inject('ConsoleClient') private consoleClient: ConsoleClient, - @inject('OperationClient') private operationClinet: OperationClient, - ) { - } + @inject("ClipboardRepository") private repository: ClipboardRepository, + @inject("SettingRepository") private settingRepository: SettingRepository, + @inject("ConsoleClient") private consoleClient: ConsoleClient, + @inject("OperationClient") private operationClinet: OperationClient + ) {} async yankCurrentURL(): Promise<string> { const url = window.location.href; this.repository.write(url); - await this.consoleClient.info('Yanked ' + url); + await this.consoleClient.info("Yanked " + url); return Promise.resolve(url); } diff --git a/src/content/usecases/ConsoleFrameUseCase.ts b/src/content/usecases/ConsoleFrameUseCase.ts index 3c4b0a1..b118c7f 100644 --- a/src/content/usecases/ConsoleFrameUseCase.ts +++ b/src/content/usecases/ConsoleFrameUseCase.ts @@ -1,13 +1,12 @@ -import { injectable, inject } from 'tsyringe'; -import ConsoleFramePresenter from '../presenters/ConsoleFramePresenter'; +import { injectable, inject } from "tsyringe"; +import ConsoleFramePresenter from "../presenters/ConsoleFramePresenter"; @injectable() export default class ConsoleFrameUseCase { constructor( - @inject('ConsoleFramePresenter') - private consoleFramePresenter: ConsoleFramePresenter, - ) { - } + @inject("ConsoleFramePresenter") + private consoleFramePresenter: ConsoleFramePresenter + ) {} unfocus() { window.focus(); diff --git a/src/content/usecases/FindSlaveUseCase.ts b/src/content/usecases/FindSlaveUseCase.ts index 0a5c2ce..3b8c4b4 100644 --- a/src/content/usecases/FindSlaveUseCase.ts +++ b/src/content/usecases/FindSlaveUseCase.ts @@ -1,12 +1,11 @@ -import { injectable, inject } from 'tsyringe'; -import FindMasterClient from '../client/FindMasterClient'; +import { injectable, inject } from "tsyringe"; +import FindMasterClient from "../client/FindMasterClient"; @injectable() export default class FindSlaveUseCase { constructor( - @inject('FindMasterClient') private findMasterClient: FindMasterClient, - ) { - } + @inject("FindMasterClient") private findMasterClient: FindMasterClient + ) {} findNext() { this.findMasterClient.findNext(); diff --git a/src/content/usecases/FindUseCase.ts b/src/content/usecases/FindUseCase.ts index c6a478f..bff0eee 100644 --- a/src/content/usecases/FindUseCase.ts +++ b/src/content/usecases/FindUseCase.ts @@ -1,18 +1,17 @@ -import { injectable, inject } from 'tsyringe'; -import FindPresenter from '../presenters/FindPresenter'; -import FindRepository from '../repositories/FindRepository'; -import FindClient from '../client/FindClient'; -import ConsoleClient from '../client/ConsoleClient'; +import { injectable, inject } from "tsyringe"; +import FindPresenter from "../presenters/FindPresenter"; +import FindRepository from "../repositories/FindRepository"; +import FindClient from "../client/FindClient"; +import ConsoleClient from "../client/ConsoleClient"; @injectable() export default class FindUseCase { constructor( - @inject('FindPresenter') private presenter: FindPresenter, - @inject('FindRepository') private repository: FindRepository, - @inject('FindClient') private client: FindClient, - @inject('ConsoleClient') private consoleClient: ConsoleClient, - ) { - } + @inject("FindPresenter") private presenter: FindPresenter, + @inject("FindRepository") private repository: FindRepository, + @inject("FindClient") private client: FindClient, + @inject("ConsoleClient") private consoleClient: ConsoleClient + ) {} async startFind(keyword?: string): Promise<void> { this.presenter.clearSelection(); @@ -36,18 +35,16 @@ export default class FindUseCase { return this.findNextPrev(true); } - private async findNextPrev( - backwards: boolean, - ): Promise<void> { + private async findNextPrev(backwards: boolean): Promise<void> { const keyword = await this.getKeyword(); if (!keyword) { return this.showNoLastKeywordError(); } const found = this.presenter.find(keyword, backwards); if (found) { - this.consoleClient.info('Pattern found: ' + keyword); + this.consoleClient.info("Pattern found: " + keyword); } else { - this.consoleClient.error('Pattern not found: ' + keyword); + this.consoleClient.error("Pattern not found: " + keyword); } } @@ -65,6 +62,6 @@ export default class FindUseCase { } private async showNoLastKeywordError(): Promise<void> { - await this.consoleClient.error('No previous search keywords'); + await this.consoleClient.error("No previous search keywords"); } } diff --git a/src/content/usecases/FocusUseCase.ts b/src/content/usecases/FocusUseCase.ts index 0158672..8c62003 100644 --- a/src/content/usecases/FocusUseCase.ts +++ b/src/content/usecases/FocusUseCase.ts @@ -1,12 +1,9 @@ -import { injectable, inject } from 'tsyringe'; -import FocusPresenter from '../presenters/FocusPresenter'; +import { injectable, inject } from "tsyringe"; +import FocusPresenter from "../presenters/FocusPresenter"; @injectable() export default class FocusUseCases { - constructor( - @inject('FocusPresenter') private presenter: FocusPresenter, - ) { - } + constructor(@inject("FocusPresenter") private presenter: FocusPresenter) {} focusFirstInput() { this.presenter.focusFirstElement(); diff --git a/src/content/usecases/FollowMasterUseCase.ts b/src/content/usecases/FollowMasterUseCase.ts index 0e7f394..329f05a 100644 --- a/src/content/usecases/FollowMasterUseCase.ts +++ b/src/content/usecases/FollowMasterUseCase.ts @@ -1,10 +1,10 @@ -import { injectable, inject } from 'tsyringe'; -import FollowKeyRepository from '../repositories/FollowKeyRepository'; -import FollowMasterRepository from '../repositories/FollowMasterRepository'; -import FollowSlaveClient from '../client/FollowSlaveClient'; -import FollowSlaveClientFactory from '../client/FollowSlaveClientFactory'; -import SettingRepository from '../repositories/SettingRepository'; -import HintKeyProducer from './HintKeyProducer'; +import { injectable, inject } from "tsyringe"; +import FollowKeyRepository from "../repositories/FollowKeyRepository"; +import FollowMasterRepository from "../repositories/FollowMasterRepository"; +import FollowSlaveClient from "../client/FollowSlaveClient"; +import FollowSlaveClientFactory from "../client/FollowSlaveClientFactory"; +import SettingRepository from "../repositories/SettingRepository"; +import HintKeyProducer from "./HintKeyProducer"; @injectable() export default class FollowMasterUseCase { @@ -12,17 +12,17 @@ export default class FollowMasterUseCase { private producer: HintKeyProducer | null; constructor( - @inject('FollowKeyRepository') + @inject("FollowKeyRepository") private followKeyRepository: FollowKeyRepository, - @inject('FollowMasterRepository') + @inject("FollowMasterRepository") private followMasterRepository: FollowMasterRepository, - @inject('SettingRepository') + @inject("SettingRepository") private settingRepository: SettingRepository, - @inject('FollowSlaveClientFactory') - private followSlaveClientFactory: FollowSlaveClientFactory, + @inject("FollowSlaveClientFactory") + private followSlaveClientFactory: FollowSlaveClientFactory ) { this.producer = null; } @@ -36,19 +36,21 @@ export default class FollowMasterUseCase { const viewWidth = window.top.innerWidth; const viewHeight = window.top.innerHeight; - this.followSlaveClientFactory.create(window.top).requestHintCount( - { width: viewWidth, height: viewHeight }, - { x: 0, y: 0 }, - ); + this.followSlaveClientFactory + .create(window.top) + .requestHintCount( + { width: viewWidth, height: viewHeight }, + { x: 0, y: 0 } + ); - const frameElements = window.document.querySelectorAll('iframe'); + const frameElements = window.document.querySelectorAll("iframe"); for (let i = 0; i < frameElements.length; ++i) { const ele = frameElements[i] as HTMLFrameElement | HTMLIFrameElement; const { left: frameX, top: frameY } = ele.getBoundingClientRect(); const client = this.followSlaveClientFactory.create(ele.contentWindow!!); client.requestHintCount( { width: viewWidth, height: viewHeight }, - { x: frameX, y: frameY }, + { x: frameX, y: frameY } ); } } @@ -67,8 +69,10 @@ export default class FollowMasterUseCase { const viewHeight = window.innerHeight || doc.documentElement.clientHeight; let pos = { x: 0, y: 0 }; if (sender !== window) { - const frameElements = window.document.querySelectorAll('iframe'); - const ele = Array.from(frameElements).find(e => e.contentWindow === sender); + const frameElements = window.document.querySelectorAll("iframe"); + const ele = Array.from(frameElements).find( + (e) => e.contentWindow === sender + ); if (!ele) { // elements of the sender is gone return; @@ -77,11 +81,7 @@ export default class FollowMasterUseCase { pos = { x: frameX, y: frameY }; } const client = this.followSlaveClientFactory.create(sender); - client.createHints( - { width: viewWidth, height: viewHeight }, - pos, - produced, - ); + client.createHints({ width: viewWidth, height: viewHeight }, pos, produced); } cancelFollow(): void { @@ -110,17 +110,17 @@ export default class FollowMasterUseCase { enqueue(key: string): void { switch (key) { - case 'Enter': - this.activate(this.getCurrentTag()); - return; - case 'Esc': - this.cancelFollow(); - return; - case 'Backspace': - case 'Delete': - this.followKeyRepository.popKey(); - this.filter(this.getCurrentTag()); - return; + case "Enter": + this.activate(this.getCurrentTag()); + return; + case "Esc": + this.cancelFollow(); + return; + case "Backspace": + case "Delete": + this.followKeyRepository.popKey(); + this.filter(this.getCurrentTag()); + return; } this.followKeyRepository.pushKey(key); @@ -138,13 +138,15 @@ export default class FollowMasterUseCase { private broadcastToSlaves(handler: (client: FollowSlaveClient) => void) { const allFrames = [window.self].concat(Array.from(window.frames as any)); - const clients = allFrames.map(w => this.followSlaveClientFactory.create(w)); + const clients = allFrames.map((w) => + this.followSlaveClientFactory.create(w) + ); for (const client of clients) { handler(client); } } private getCurrentTag(): string { - return this.followKeyRepository.getKeys().join(''); + return this.followKeyRepository.getKeys().join(""); } } diff --git a/src/content/usecases/FollowSlaveUseCase.ts b/src/content/usecases/FollowSlaveUseCase.ts index fb805b9..971ecee 100644 --- a/src/content/usecases/FollowSlaveUseCase.ts +++ b/src/content/usecases/FollowSlaveUseCase.ts @@ -1,10 +1,10 @@ -import { injectable, inject } from 'tsyringe'; -import FollowSlaveRepository from '../repositories/FollowSlaveRepository'; -import FollowPresenter from '../presenters/FollowPresenter'; -import TabsClient from '../client/TabsClient'; -import FollowMasterClient from '../client/FollowMasterClient'; -import { LinkHint, InputHint } from '../presenters/Hint'; -import Key from '../../shared/settings/Key'; +import { injectable, inject } from "tsyringe"; +import FollowSlaveRepository from "../repositories/FollowSlaveRepository"; +import FollowPresenter from "../presenters/FollowPresenter"; +import TabsClient from "../client/TabsClient"; +import FollowMasterClient from "../client/FollowMasterClient"; +import { LinkHint, InputHint } from "../presenters/Hint"; +import Key from "../../shared/settings/Key"; interface Size { width: number; @@ -19,19 +19,18 @@ interface Point { @injectable() export default class FollowSlaveUseCase { constructor( - @inject('FollowPresenter') + @inject("FollowPresenter") private presenter: FollowPresenter, - @inject('TabsClient') + @inject("TabsClient") private tabsClient: TabsClient, - @inject('FollowMasterClient') + @inject("FollowMasterClient") private followMasterClient: FollowMasterClient, - @inject('FollowSlaveRepository') - private followSlaveRepository: FollowSlaveRepository, - ) { - } + @inject("FollowSlaveRepository") + private followSlaveRepository: FollowSlaveRepository + ) {} countTargets(viewSize: Size, framePosition: Point): void { const count = this.presenter.getTargetCount(viewSize, framePosition); @@ -65,11 +64,11 @@ export default class FollowSlaveUseCase { const url = hint.getLink(); let openNewTab = newTab; // Open link by background script in order to prevent a popup block - if (hint.getLinkTarget() === '_blank') { + if (hint.getLinkTarget() === "_blank") { openNewTab = true; } // eslint-disable-next-line no-script-url - if (!url || url === '#' || url.toLowerCase().startsWith('javascript:')) { + if (!url || url === "#" || url.toLowerCase().startsWith("javascript:")) { return; } await this.tabsClient.openUrl(url, openNewTab, background); diff --git a/src/content/usecases/HintKeyProducer.ts b/src/content/usecases/HintKeyProducer.ts index 68f3fbd..a5e2877 100644 --- a/src/content/usecases/HintKeyProducer.ts +++ b/src/content/usecases/HintKeyProducer.ts @@ -5,7 +5,7 @@ export default class HintKeyProducer { constructor(charset: string) { if (charset.length === 0) { - throw new TypeError('charset is empty'); + throw new TypeError("charset is empty"); } this.charset = charset; @@ -15,12 +15,12 @@ export default class HintKeyProducer { produce(): string { this.increment(); - return this.counter.map(x => this.charset[x]).join(''); + return this.counter.map((x) => this.charset[x]).join(""); } private increment(): void { const max = this.charset.length - 1; - if (this.counter.every(x => x === max)) { + if (this.counter.every((x) => x === max)) { this.counter = new Array(this.counter.length + 1).fill(0); return; } @@ -35,4 +35,3 @@ export default class HintKeyProducer { this.counter.reverse(); } } - diff --git a/src/content/usecases/KeymapUseCase.ts b/src/content/usecases/KeymapUseCase.ts index e02bc48..3cbadcb 100644 --- a/src/content/usecases/KeymapUseCase.ts +++ b/src/content/usecases/KeymapUseCase.ts @@ -1,16 +1,16 @@ -import { injectable, inject } from 'tsyringe'; -import KeymapRepository from '../repositories/KeymapRepository'; -import SettingRepository from '../repositories/SettingRepository'; -import AddonEnabledRepository from '../repositories/AddonEnabledRepository'; -import * as operations from '../../shared/operations'; -import Keymaps from '../../shared/settings/Keymaps'; -import Key from '../../shared/settings/Key'; -import KeySequence from '../domains/KeySequence'; -import AddressRepository from '../repositories/AddressRepository'; +import { injectable, inject } from "tsyringe"; +import KeymapRepository from "../repositories/KeymapRepository"; +import SettingRepository from "../repositories/SettingRepository"; +import AddonEnabledRepository from "../repositories/AddonEnabledRepository"; +import * as operations from "../../shared/operations"; +import Keymaps from "../../shared/settings/Keymaps"; +import Key from "../../shared/settings/Key"; +import KeySequence from "../domains/KeySequence"; +import AddressRepository from "../repositories/AddressRepository"; const reservedKeymaps = Keymaps.fromJSON({ - '<Esc>': { type: operations.CANCEL }, - '<C-[>': { type: operations.CANCEL }, + "<Esc>": { type: operations.CANCEL }, + "<C-[>": { type: operations.CANCEL }, }); const enableAddonOps = [ @@ -21,22 +21,21 @@ const enableAddonOps = [ @injectable() export default class KeymapUseCase { constructor( - @inject('KeymapRepository') + @inject("KeymapRepository") private repository: KeymapRepository, - @inject('SettingRepository') + @inject("SettingRepository") private settingRepository: SettingRepository, - @inject('AddonEnabledRepository') + @inject("AddonEnabledRepository") private addonEnabledRepository: AddonEnabledRepository, - @inject('AddressRepository') - private addressRepository: AddressRepository, - ) { - } + @inject("AddressRepository") + private addressRepository: AddressRepository + ) {} // eslint-disable-next-line max-statements - nextOps(key: Key): { repeat: number, op: operations.Operation } | null { + nextOps(key: Key): { repeat: number; op: operations.Operation } | null { const sequence = this.repository.enqueueKey(key); const baseSequence = sequence.trimNumericPrefix(); const keymaps = this.keymapEntityMap(); @@ -49,14 +48,14 @@ export default class KeymapUseCase { return null; } - if (matched.length === 1 && - sequence.length() === matched[0][0].length()) { + if (matched.length === 1 && sequence.length() === matched[0][0].length()) { // keys are matched with an operation this.repository.clear(); return { repeat: 1, op: matched[0][1] }; } else if ( baseMatched.length === 1 && - baseSequence.length() === baseMatched[0][0].length()) { + baseSequence.length() === baseMatched[0][0].length() + ) { // keys are matched with an operation with a numeric prefix this.repository.clear(); return { repeat: sequence.repeatCount(), op: baseMatched[0][1] }; @@ -75,15 +74,20 @@ export default class KeymapUseCase { } private keymapEntityMap(): [KeySequence, operations.Operation][] { - const keymaps = this.settingRepository.get().keymaps.combine(reservedKeymaps); - let entries = keymaps.entries().map( - ([keys, op]) => [KeySequence.fromMapKeys(keys), op] - ) as [KeySequence, operations.Operation][]; + const keymaps = this.settingRepository + .get() + .keymaps.combine(reservedKeymaps); + let entries = keymaps + .entries() + .map(([keys, op]) => [KeySequence.fromMapKeys(keys), op]) as [ + KeySequence, + operations.Operation + ][]; if (!this.addonEnabledRepository.get()) { // available keymaps are only ADDON_ENABLE and ADDON_TOGGLE_ENABLED if // the addon disabled - entries = entries.filter( - ([_seq, { type }]) => enableAddonOps.includes(type) + entries = entries.filter(([_seq, { type }]) => + enableAddonOps.includes(type) ); } return entries; diff --git a/src/content/usecases/MarkKeyUseCase.ts b/src/content/usecases/MarkKeyUseCase.ts index 6cef6f2..b807c74 100644 --- a/src/content/usecases/MarkKeyUseCase.ts +++ b/src/content/usecases/MarkKeyUseCase.ts @@ -1,12 +1,11 @@ -import { injectable, inject } from 'tsyringe'; -import MarkKeyRepository from '../repositories/MarkKeyRepository'; +import { injectable, inject } from "tsyringe"; +import MarkKeyRepository from "../repositories/MarkKeyRepository"; @injectable() export default class MarkKeyUseCase { constructor( - @inject('MarkKeyRepository') private repository: MarkKeyRepository, - ) { - } + @inject("MarkKeyRepository") private repository: MarkKeyRepository + ) {} isSetMode(): boolean { return this.repository.isSetMode(); diff --git a/src/content/usecases/MarkUseCase.ts b/src/content/usecases/MarkUseCase.ts index 8cd0c72..002fdee 100644 --- a/src/content/usecases/MarkUseCase.ts +++ b/src/content/usecases/MarkUseCase.ts @@ -1,20 +1,19 @@ -import { injectable, inject } from 'tsyringe'; -import ScrollPresenter from '../presenters/ScrollPresenter'; -import MarkClient from '../client/MarkClient'; -import MarkRepository from '../repositories/MarkRepository'; -import SettingRepository from '../repositories/SettingRepository'; -import ConsoleClient from '../client/ConsoleClient'; +import { injectable, inject } from "tsyringe"; +import ScrollPresenter from "../presenters/ScrollPresenter"; +import MarkClient from "../client/MarkClient"; +import MarkRepository from "../repositories/MarkRepository"; +import SettingRepository from "../repositories/SettingRepository"; +import ConsoleClient from "../client/ConsoleClient"; @injectable() export default class MarkUseCase { constructor( - @inject('ScrollPresenter') private scrollPresenter: ScrollPresenter, - @inject('MarkClient') private client: MarkClient, - @inject('MarkRepository') private repository: MarkRepository, - @inject('SettingRepository') private settingRepository: SettingRepository, - @inject('ConsoleClient') private consoleClient: ConsoleClient, - ) { - } + @inject("ScrollPresenter") private scrollPresenter: ScrollPresenter, + @inject("MarkClient") private client: MarkClient, + @inject("MarkRepository") private repository: MarkRepository, + @inject("SettingRepository") private settingRepository: SettingRepository, + @inject("ConsoleClient") private consoleClient: ConsoleClient + ) {} async set(key: string): Promise<void> { const pos = this.scrollPresenter.getScroll(); @@ -33,7 +32,7 @@ export default class MarkUseCase { } else { const pos = this.repository.get(key); if (!pos) { - throw new Error('Mark is not set'); + throw new Error("Mark is not set"); } this.scroll(pos.x, pos.y); } @@ -45,6 +44,6 @@ export default class MarkUseCase { } private globalKey(key: string) { - return (/^[A-Z0-9]$/).test(key); + return /^[A-Z0-9]$/.test(key); } } diff --git a/src/content/usecases/NavigateUseCase.ts b/src/content/usecases/NavigateUseCase.ts index 7adccfd..c704980 100644 --- a/src/content/usecases/NavigateUseCase.ts +++ b/src/content/usecases/NavigateUseCase.ts @@ -1,13 +1,12 @@ -import { injectable, inject } from 'tsyringe'; -import NavigationPresenter from '../presenters/NavigationPresenter'; +import { injectable, inject } from "tsyringe"; +import NavigationPresenter from "../presenters/NavigationPresenter"; @injectable() export default class NavigateUseCase { constructor( - @inject('NavigationPresenter') - private navigationPresenter: NavigationPresenter, - ) { - } + @inject("NavigationPresenter") + private navigationPresenter: NavigationPresenter + ) {} openHistoryPrev(): void { this.navigationPresenter.openHistoryPrev(); diff --git a/src/content/usecases/ScrollUseCase.ts b/src/content/usecases/ScrollUseCase.ts index c68c889..319c8b4 100644 --- a/src/content/usecases/ScrollUseCase.ts +++ b/src/content/usecases/ScrollUseCase.ts @@ -1,14 +1,13 @@ -import { injectable, inject } from 'tsyringe'; -import ScrollPresenter from '../presenters/ScrollPresenter'; -import SettingRepository from '../repositories/SettingRepository'; +import { injectable, inject } from "tsyringe"; +import ScrollPresenter from "../presenters/ScrollPresenter"; +import SettingRepository from "../repositories/SettingRepository"; @injectable() export default class ScrollUseCase { constructor( - @inject('ScrollPresenter') private presenter: ScrollPresenter, - @inject('SettingRepository') private settingRepository: SettingRepository, - ) { - } + @inject("ScrollPresenter") private presenter: ScrollPresenter, + @inject("SettingRepository") private settingRepository: SettingRepository + ) {} scrollVertically(count: number): void { const smooth = this.getSmoothScroll(); diff --git a/src/content/usecases/SettingUseCase.ts b/src/content/usecases/SettingUseCase.ts index 67d1be6..b2b24aa 100644 --- a/src/content/usecases/SettingUseCase.ts +++ b/src/content/usecases/SettingUseCase.ts @@ -1,15 +1,14 @@ -import { injectable, inject } from 'tsyringe'; -import SettingRepository from '../repositories/SettingRepository'; -import SettingClient from '../client/SettingClient'; -import Settings from '../../shared/settings/Settings'; +import { injectable, inject } from "tsyringe"; +import SettingRepository from "../repositories/SettingRepository"; +import SettingClient from "../client/SettingClient"; +import Settings from "../../shared/settings/Settings"; @injectable() export default class SettingUseCase { constructor( - @inject('SettingRepository') private repository: SettingRepository, - @inject('SettingClient') private client: SettingClient, - ) { - } + @inject("SettingRepository") private repository: SettingRepository, + @inject("SettingClient") private client: SettingClient + ) {} async reload(): Promise<Settings> { const settings = await this.client.load(); |