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/console/clients | |
parent | 685f2b7b69218b06b5bb676069e35f79c5048c9b (diff) | |
parent | 75abd90ecb8201ad845b266f96220d8adfe19b2d (diff) |
Merge pull request #749 from ueokande/qa-0.28
QA 0.28
Diffstat (limited to 'src/console/clients')
-rw-r--r-- | src/console/clients/CompletionClient.ts | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/src/console/clients/CompletionClient.ts b/src/console/clients/CompletionClient.ts index 56dc665..64119e8 100644 --- a/src/console/clients/CompletionClient.ts +++ b/src/console/clients/CompletionClient.ts @@ -1,84 +1,87 @@ import * as messages from "../../shared/messages"; import { - ConsoleGetCompletionTypesResponse, ConsoleGetPropertiesResponse, + ConsoleGetCompletionTypesResponse, + ConsoleGetPropertiesResponse, ConsoleRequestBookmarksResponse, - ConsoleRequestHistoryResponse, ConsoleRequestSearchEnginesResponse, ConsoleRequesttabsResponse + ConsoleRequestHistoryResponse, + ConsoleRequestSearchEnginesResponse, + ConsoleRequesttabsResponse, } from "../../shared/messages"; import CompletionType from "../../shared/CompletionType"; import TabFlag from "../../shared/TabFlag"; export type SearchEngines = { - title: string -} + title: string; +}; export type BookmarkItem = { - title: string - url: string -} + title: string; + url: string; +}; export type HistoryItem = { - title: string - url: string -} + title: string; + url: string; +}; export type TabItem = { - index: number - flag: TabFlag - title: string - url: string - faviconUrl?: string -} + index: number; + flag: TabFlag; + title: string; + url: string; + faviconUrl?: string; +}; export type Property = { - name: string - type: 'string' | 'boolean' | 'number'; -} + name: string; + type: "string" | "boolean" | "number"; +}; export default class CompletionClient { async getCompletionTypes(): Promise<CompletionType[]> { - const resp = await browser.runtime.sendMessage({ + const resp = (await browser.runtime.sendMessage({ type: messages.CONSOLE_GET_COMPLETION_TYPES, - }) as ConsoleGetCompletionTypesResponse; + })) as ConsoleGetCompletionTypesResponse; return resp; } async requestSearchEngines(query: string): Promise<SearchEngines[]> { - const resp = await browser.runtime.sendMessage({ + const resp = (await browser.runtime.sendMessage({ type: messages.CONSOLE_REQUEST_SEARCH_ENGINES_MESSAGE, query, - }) as ConsoleRequestSearchEnginesResponse; + })) as ConsoleRequestSearchEnginesResponse; return resp; } async requestBookmarks(query: string): Promise<BookmarkItem[]> { - const resp = await browser.runtime.sendMessage({ + const resp = (await browser.runtime.sendMessage({ type: messages.CONSOLE_REQUEST_BOOKMARKS, query, - }) as ConsoleRequestBookmarksResponse; + })) as ConsoleRequestBookmarksResponse; return resp; } async requestHistory(query: string): Promise<HistoryItem[]> { - const resp = await browser.runtime.sendMessage({ + const resp = (await browser.runtime.sendMessage({ type: messages.CONSOLE_REQUEST_HISTORY, query, - }) as ConsoleRequestHistoryResponse; + })) as ConsoleRequestHistoryResponse; return resp; } async requestTabs(query: string, excludePinned: boolean): Promise<TabItem[]> { - const resp = await browser.runtime.sendMessage({ + const resp = (await browser.runtime.sendMessage({ type: messages.CONSOLE_REQUEST_TABS, query, excludePinned, - }) as ConsoleRequesttabsResponse; + })) as ConsoleRequesttabsResponse; return resp; } async getProperties(): Promise<Property[]> { - const resp = await browser.runtime.sendMessage({ + const resp = (await browser.runtime.sendMessage({ type: messages.CONSOLE_GET_PROPERTIES, - }) as ConsoleGetPropertiesResponse; + })) as ConsoleGetPropertiesResponse; return resp; } } |