From ba19c573a76c75469b5b2ed9093f8373907ea364 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 14 Mar 2021 14:54:12 +0900 Subject: Specific return type --- src/background/usecases/CommandUseCase.ts | 16 ++++++++-------- src/background/usecases/FindUseCase.ts | 2 +- src/background/usecases/LinkUseCase.ts | 8 ++++---- src/background/usecases/MarkUseCase.ts | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/background/usecases') diff --git a/src/background/usecases/CommandUseCase.ts b/src/background/usecases/CommandUseCase.ts index 18ddd4d..29e6e7c 100644 --- a/src/background/usecases/CommandUseCase.ts +++ b/src/background/usecases/CommandUseCase.ts @@ -58,7 +58,7 @@ export default class CommandUseCase { } // eslint-disable-next-line max-statements - async buffer(keywords: string): Promise { + async buffer(keywords: string): Promise { if (keywords.length === 0) { return; } @@ -95,7 +95,7 @@ export default class CommandUseCase { return this.tabPresenter.select(tabs[0].id as number); } - async bdelete(force: boolean, keywords: string): Promise { + async bdelete(force: boolean, keywords: string): Promise { const excludePinned = !force; const tabs = await this.tabPresenter.getByKeyword(keywords, excludePinned); if (tabs.length === 0) { @@ -106,32 +106,32 @@ export default class CommandUseCase { return this.tabPresenter.remove([tabs[0].id as number]); } - async bdeletes(force: boolean, keywords: string): Promise { + async bdeletes(force: boolean, keywords: string): Promise { const excludePinned = !force; const tabs = await this.tabPresenter.getByKeyword(keywords, excludePinned); const ids = tabs.map((tab) => tab.id as number); return this.tabPresenter.remove(ids); } - async quit(): Promise { + async quit(): Promise { const tab = await this.tabPresenter.getCurrent(); return this.tabPresenter.remove([tab.id as number]); } - async quitAll(): Promise { + async quitAll(): Promise { const tabs = await this.tabPresenter.getAll(); const ids = tabs.map((tab) => tab.id as number); this.tabPresenter.remove(ids); } - async addbookmark(title: string): Promise { + async addbookmark(title: string): Promise { const tab = await this.tabPresenter.getCurrent(); const item = await this.bookmarkRepository.create(title, tab.url as string); const message = "Saved current page: " + item.url; return this.consoleClient.showInfo(tab.id as number, message); } - async set(keywords: string): Promise { + async set(keywords: string): Promise { if (keywords.length === 0) { return; } @@ -145,7 +145,7 @@ export default class CommandUseCase { return this.helpPresenter.open(); } - private async urlOrSearch(keywords: string): Promise { + private async urlOrSearch(keywords: string): Promise { const settings = await this.cachedSettingRepository.get(); return urls.searchUrl(keywords, settings.search); } diff --git a/src/background/usecases/FindUseCase.ts b/src/background/usecases/FindUseCase.ts index ce96e03..cc111f2 100644 --- a/src/background/usecases/FindUseCase.ts +++ b/src/background/usecases/FindUseCase.ts @@ -9,7 +9,7 @@ export default class FindUseCase { return this.findRepository.getKeyword(); } - setKeyword(keyword: string): Promise { + setKeyword(keyword: string): Promise { return this.findRepository.setKeyword(keyword); } } diff --git a/src/background/usecases/LinkUseCase.ts b/src/background/usecases/LinkUseCase.ts index d2cd464..7fa3d9c 100644 --- a/src/background/usecases/LinkUseCase.ts +++ b/src/background/usecases/LinkUseCase.ts @@ -5,15 +5,15 @@ import TabPresenter from "../presenters/TabPresenter"; export default class LinkUseCase { constructor(@inject("TabPresenter") private tabPresenter: TabPresenter) {} - openToTab(url: string, tabId: number): Promise { - return this.tabPresenter.open(url, tabId); + async openToTab(url: string, tabId: number): Promise { + await this.tabPresenter.open(url, tabId); } async openNewTab( url: string, openerId: number, background: boolean - ): Promise { + ): Promise { const properties: any = { active: !background }; const platform = await browser.runtime.getPlatformInfo(); @@ -22,6 +22,6 @@ export default class LinkUseCase { properties.openerTabId = openerId; } - return this.tabPresenter.create(url, properties); + await this.tabPresenter.create(url, properties); } } diff --git a/src/background/usecases/MarkUseCase.ts b/src/background/usecases/MarkUseCase.ts index 57e04b4..e9640ee 100644 --- a/src/background/usecases/MarkUseCase.ts +++ b/src/background/usecases/MarkUseCase.ts @@ -15,13 +15,13 @@ export default class MarkUseCase { private readonly contentMessageClient: ContentMessageClient ) {} - async setGlobal(key: string, x: number, y: number): Promise { + async setGlobal(key: string, x: number, y: number): Promise { const tab = await this.tabPresenter.getCurrent(); const mark = { tabId: tab.id as number, url: tab.url as string, x, y }; return this.markRepository.setMark(key, mark); } - async jumpGlobal(key: string): Promise { + async jumpGlobal(key: string): Promise { const current = await this.tabPresenter.getCurrent(); const mark = await this.markRepository.getMark(key); -- cgit v1.2.3