diff options
Diffstat (limited to 'src/background')
-rw-r--r-- | src/background/completion/PropertyCompletionUseCase.ts | 16 | ||||
-rw-r--r-- | src/background/controllers/CompletionController.ts | 7 | ||||
-rw-r--r-- | src/background/infrastructures/ContentMessageListener.ts | 2 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/background/completion/PropertyCompletionUseCase.ts b/src/background/completion/PropertyCompletionUseCase.ts new file mode 100644 index 0000000..049cfb8 --- /dev/null +++ b/src/background/completion/PropertyCompletionUseCase.ts @@ -0,0 +1,16 @@ +import { injectable } from "tsyringe"; +import Properties from "../../shared/settings/Properties"; + +type Property = { + name: string; + type: 'string' | 'boolean' | 'number'; +} +@injectable() +export default class PropertyCompletionUseCase { + async getProperties(): Promise<Property[]> { + return Properties.defs().map(def => ({ + name: def.name, + type: def.type, + })); + } +}
\ No newline at end of file diff --git a/src/background/controllers/CompletionController.ts b/src/background/controllers/CompletionController.ts index a268d15..fb6137c 100644 --- a/src/background/controllers/CompletionController.ts +++ b/src/background/controllers/CompletionController.ts @@ -1,5 +1,6 @@ import { ConsoleGetCompletionTypesResponse, + ConsoleGetPropertiesResponse, ConsoleRequestBookmarksResponse, ConsoleRequestHistoryResponse, ConsoleRequestSearchEnginesResponse, @@ -8,12 +9,14 @@ import { import { injectable } from "tsyringe"; import OpenCompletionUseCase from "../completion/OpenCompletionUseCase"; import TabCompletionUseCase from "../completion/TabCompletionUseCase"; +import PropertyCompletionUseCase from "../completion/PropertyCompletionUseCase"; @injectable() export default class CompletionController { constructor( private completionUseCase: OpenCompletionUseCase, private tabCompletionUseCase: TabCompletionUseCase, + private propertyCompletionUseCase: PropertyCompletionUseCase, ) { } @@ -37,4 +40,8 @@ export default class CompletionController { async queryTabs(query: string, excludePinned: boolean): Promise<ConsoleRequesttabsResponse> { return this.tabCompletionUseCase.queryTabs(query, excludePinned); } + + async getProperties(): Promise<ConsoleGetPropertiesResponse> { + return this.propertyCompletionUseCase.getProperties(); + } }
\ No newline at end of file diff --git a/src/background/infrastructures/ContentMessageListener.ts b/src/background/infrastructures/ContentMessageListener.ts index 13aa763..92481da 100644 --- a/src/background/infrastructures/ContentMessageListener.ts +++ b/src/background/infrastructures/ContentMessageListener.ts @@ -75,6 +75,8 @@ export default class ContentMessageListener { return this.completionController.requestHistory(message.query); case messages.CONSOLE_REQUEST_TABS: return this.completionController.queryTabs(message.query, message.excludePinned); + case messages.CONSOLE_GET_PROPERTIES: + return this.completionController.getProperties(); case messages.CONSOLE_ENTER_COMMAND: return this.onConsoleEnterCommand(message.text); case messages.SETTINGS_QUERY: |