diff options
Diffstat (limited to 'src/background')
-rw-r--r-- | src/background/controllers/AddonEnabledController.ts | 2 | ||||
-rw-r--r-- | src/background/controllers/CommandController.ts | 2 | ||||
-rw-r--r-- | src/background/controllers/FindController.ts | 2 | ||||
-rw-r--r-- | src/background/controllers/MarkController.ts | 4 | ||||
-rw-r--r-- | src/background/controllers/OperationController.ts | 4 | ||||
-rw-r--r-- | src/background/controllers/SettingController.ts | 2 | ||||
-rw-r--r-- | src/background/infrastructures/ConsoleClient.ts | 20 | ||||
-rw-r--r-- | src/background/infrastructures/ContentMessageListener.ts | 21 | ||||
-rw-r--r-- | src/background/repositories/FindRepository.ts | 2 | ||||
-rw-r--r-- | src/background/repositories/MarkRepository.ts | 2 | ||||
-rw-r--r-- | src/background/usecases/CommandUseCase.ts | 16 | ||||
-rw-r--r-- | src/background/usecases/FindUseCase.ts | 2 | ||||
-rw-r--r-- | src/background/usecases/LinkUseCase.ts | 8 | ||||
-rw-r--r-- | src/background/usecases/MarkUseCase.ts | 4 |
14 files changed, 47 insertions, 44 deletions
diff --git a/src/background/controllers/AddonEnabledController.ts b/src/background/controllers/AddonEnabledController.ts index 170abdf..fd69a69 100644 --- a/src/background/controllers/AddonEnabledController.ts +++ b/src/background/controllers/AddonEnabledController.ts @@ -5,7 +5,7 @@ import AddonEnabledUseCase from "../usecases/AddonEnabledUseCase"; export default class AddonEnabledController { constructor(private addonEnabledUseCase: AddonEnabledUseCase) {} - indicate(enabled: boolean): Promise<any> { + indicate(enabled: boolean): Promise<void> { return this.addonEnabledUseCase.indicate(enabled); } } diff --git a/src/background/controllers/CommandController.ts b/src/background/controllers/CommandController.ts index f19303f..bde401a 100644 --- a/src/background/controllers/CommandController.ts +++ b/src/background/controllers/CommandController.ts @@ -11,7 +11,7 @@ export default class CommandController { constructor(private commandIndicator: CommandUseCase) {} // eslint-disable-next-line complexity - exec(line: string): Promise<any> { + exec(line: string): Promise<unknown> { const trimmed = trimStart(line); const words = trimmed.split(/ +/); const name = words[0]; diff --git a/src/background/controllers/FindController.ts b/src/background/controllers/FindController.ts index 92dfeb0..f3ea93f 100644 --- a/src/background/controllers/FindController.ts +++ b/src/background/controllers/FindController.ts @@ -9,7 +9,7 @@ export default class FindController { return this.findUseCase.getKeyword(); } - setKeyword(keyword: string): Promise<any> { + setKeyword(keyword: string): Promise<void> { return this.findUseCase.setKeyword(keyword); } } diff --git a/src/background/controllers/MarkController.ts b/src/background/controllers/MarkController.ts index 0d468f2..cfe425f 100644 --- a/src/background/controllers/MarkController.ts +++ b/src/background/controllers/MarkController.ts @@ -5,11 +5,11 @@ import MarkUseCase from "../usecases/MarkUseCase"; export default class MarkController { constructor(private markUseCase: MarkUseCase) {} - setGlobal(key: string, x: number, y: number): Promise<any> { + setGlobal(key: string, x: number, y: number): Promise<void> { return this.markUseCase.setGlobal(key, x, y); } - jumpGlobal(key: string): Promise<any> { + jumpGlobal(key: string): Promise<void> { return this.markUseCase.jumpGlobal(key); } } diff --git a/src/background/controllers/OperationController.ts b/src/background/controllers/OperationController.ts index d606ac0..7e43153 100644 --- a/src/background/controllers/OperationController.ts +++ b/src/background/controllers/OperationController.ts @@ -11,7 +11,7 @@ export default class OperationController { private readonly operatorFactory: OperatorFactory ) {} - async exec(repeat: number, op: operations.Operation): Promise<any> { + async exec(repeat: number, op: operations.Operation): Promise<void> { await this.doOperation(repeat, op); if (this.repeatUseCase.isRepeatable(op)) { this.repeatUseCase.storeLastOperation(op); @@ -21,7 +21,7 @@ export default class OperationController { private async doOperation( repeat: number, operation: operations.Operation - ): Promise<any> { + ): Promise<void> { const operator = this.operatorFactory.create(operation); for (let i = 0; i < repeat; ++i) { // eslint-disable-next-line no-await-in-loop diff --git a/src/background/controllers/SettingController.ts b/src/background/controllers/SettingController.ts index 4248746..cc0b89f 100644 --- a/src/background/controllers/SettingController.ts +++ b/src/background/controllers/SettingController.ts @@ -14,7 +14,7 @@ export default class SettingController { return this.settingUseCase.getCached(); } - async reload(): Promise<any> { + async reload(): Promise<void> { await this.settingUseCase.reload(); this.contentMessageClient.broadcastSettingsChanged(); } diff --git a/src/background/infrastructures/ConsoleClient.ts b/src/background/infrastructures/ConsoleClient.ts index 2a1df5b..f2d0e8a 100644 --- a/src/background/infrastructures/ConsoleClient.ts +++ b/src/background/infrastructures/ConsoleClient.ts @@ -2,47 +2,47 @@ import { injectable } from "tsyringe"; import * as messages from "../../shared/messages"; export default interface ConsoleClient { - showCommand(tabId: number, command: string): Promise<any>; + showCommand(tabId: number, command: string): Promise<void>; - showFind(tabId: number): Promise<any>; + showFind(tabId: number): Promise<void>; - showInfo(tabId: number, message: string): Promise<any>; + showInfo(tabId: number, message: string): Promise<void>; - showError(tabId: number, message: string): Promise<any>; + showError(tabId: number, message: string): Promise<void>; - hide(tabId: number): Promise<any>; + hide(tabId: number): Promise<void>; } @injectable() export class ConsoleClientImpl implements ConsoleClient { - showCommand(tabId: number, command: string): Promise<any> { + showCommand(tabId: number, command: string): Promise<void> { return browser.tabs.sendMessage(tabId, { type: messages.CONSOLE_SHOW_COMMAND, command, }); } - showFind(tabId: number): Promise<any> { + showFind(tabId: number): Promise<void> { return browser.tabs.sendMessage(tabId, { type: messages.CONSOLE_SHOW_FIND, }); } - showInfo(tabId: number, message: string): Promise<any> { + showInfo(tabId: number, message: string): Promise<void> { return browser.tabs.sendMessage(tabId, { type: messages.CONSOLE_SHOW_INFO, text: message, }); } - showError(tabId: number, message: string): Promise<any> { + showError(tabId: number, message: string): Promise<void> { return browser.tabs.sendMessage(tabId, { type: messages.CONSOLE_SHOW_ERROR, text: message, }); } - hide(tabId: number): Promise<any> { + hide(tabId: number): Promise<void> { return browser.tabs.sendMessage(tabId, { type: messages.CONSOLE_HIDE, }); diff --git a/src/background/infrastructures/ContentMessageListener.ts b/src/background/infrastructures/ContentMessageListener.ts index 6978d35..26f98ab 100644 --- a/src/background/infrastructures/ContentMessageListener.ts +++ b/src/background/infrastructures/ContentMessageListener.ts @@ -61,7 +61,7 @@ export default class ContentMessageListener { onMessage( message: messages.Message, senderTab: browser.tabs.Tab - ): Promise<any> | any { + ): Promise<unknown> | unknown { switch (message.type) { case messages.CONSOLE_GET_COMPLETION_TYPES: return this.completionController.getCompletionTypes(); @@ -110,11 +110,11 @@ export default class ContentMessageListener { throw new Error("unsupported message: " + message.type); } - onConsoleEnterCommand(text: string): Promise<any> { + onConsoleEnterCommand(text: string): Promise<unknown> { return this.commandController.exec(text); } - async onSettingsQuery(): Promise<any> { + async onSettingsQuery(): Promise<unknown> { return (await this.settingController.getSetting()).toJSON(); } @@ -122,11 +122,11 @@ export default class ContentMessageListener { return this.findController.getKeyword(); } - onFindSetKeyword(keyword: string): Promise<any> { + onFindSetKeyword(keyword: string): Promise<void> { return this.findController.setKeyword(keyword); } - onAddonEnabledResponse(enabled: boolean): Promise<any> { + onAddonEnabledResponse(enabled: boolean): Promise<void> { return this.addonEnabledController.indicate(enabled); } @@ -135,22 +135,25 @@ export default class ContentMessageListener { url: string, openerId: number, background: boolean - ): Promise<any> { + ): Promise<void> { if (newTab) { return this.linkController.openNewTab(url, openerId, background); } return this.linkController.openToTab(url, openerId); } - onBackgroundOperation(count: number, op: operations.Operation): Promise<any> { + onBackgroundOperation( + count: number, + op: operations.Operation + ): Promise<void> { return this.operationController.exec(count, op); } - onMarkSetGlobal(key: string, x: number, y: number): Promise<any> { + onMarkSetGlobal(key: string, x: number, y: number): Promise<void> { return this.markController.setGlobal(key, x, y); } - onMarkJumpGlobal(key: string): Promise<any> { + onMarkJumpGlobal(key: string): Promise<void> { return this.markController.jumpGlobal(key); } diff --git a/src/background/repositories/FindRepository.ts b/src/background/repositories/FindRepository.ts index be56284..813e065 100644 --- a/src/background/repositories/FindRepository.ts +++ b/src/background/repositories/FindRepository.ts @@ -15,7 +15,7 @@ export default class FindRepository { return Promise.resolve(this.cache.get(FIND_KEYWORD_KEY)); } - setKeyword(keyword: string): Promise<any> { + setKeyword(keyword: string): Promise<void> { this.cache.set(FIND_KEYWORD_KEY, keyword); return Promise.resolve(); } diff --git a/src/background/repositories/MarkRepository.ts b/src/background/repositories/MarkRepository.ts index e2c1e94..493b25a 100644 --- a/src/background/repositories/MarkRepository.ts +++ b/src/background/repositories/MarkRepository.ts @@ -22,7 +22,7 @@ export default class MarkRepository { return Promise.resolve(mark); } - setMark(key: string, mark: GlobalMark): Promise<any> { + setMark(key: string, mark: GlobalMark): Promise<void> { const marks = this.getOrEmptyMarks(); marks[key] = { tabId: mark.tabId, url: mark.url, x: mark.x, y: mark.y }; this.cache.set(MARK_KEY, marks); 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<any> { + async buffer(keywords: string): Promise<void> { 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<any> { + async bdelete(force: boolean, keywords: string): Promise<void> { 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<any> { + async bdeletes(force: boolean, keywords: string): Promise<void> { 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<any> { + async quit(): Promise<void> { const tab = await this.tabPresenter.getCurrent(); return this.tabPresenter.remove([tab.id as number]); } - async quitAll(): Promise<any> { + async quitAll(): Promise<void> { const tabs = await this.tabPresenter.getAll(); const ids = tabs.map((tab) => tab.id as number); this.tabPresenter.remove(ids); } - async addbookmark(title: string): Promise<any> { + async addbookmark(title: string): Promise<void> { 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<any> { + async set(keywords: string): Promise<void> { if (keywords.length === 0) { return; } @@ -145,7 +145,7 @@ export default class CommandUseCase { return this.helpPresenter.open(); } - private async urlOrSearch(keywords: string): Promise<any> { + private async urlOrSearch(keywords: string): Promise<string> { 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<any> { + setKeyword(keyword: string): Promise<void> { 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<any> { - return this.tabPresenter.open(url, tabId); + async openToTab(url: string, tabId: number): Promise<void> { + await this.tabPresenter.open(url, tabId); } async openNewTab( url: string, openerId: number, background: boolean - ): Promise<any> { + ): Promise<void> { 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<any> { + async setGlobal(key: string, x: number, y: number): Promise<void> { 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<any> { + async jumpGlobal(key: string): Promise<void> { const current = await this.tabPresenter.getCurrent(); const mark = await this.markRepository.getMark(key); |