Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface HomeRegistration

Response from home registration which includes metadata and a function to inject search string into home search

Hierarchy

Index

Properties

clientAPIVersion: string
workspaceVersion: string

Methods

  • setSearchQuery(query: string): Promise<void>
  • Function to inject search string into home search

    Parameters

    • query: string

      search string

    Returns Promise<void>

    Promise

    import Home, CLIProvider from '@openfin/workspace';

    import { fetchMySearchResults } from "./my-fetch-implementation";

    const searchQueryMap: Map<string, (query: string) => void> = new Map();

    // CLIProvider or HomeProvider
    const myCLIProvider: CLIProvider = {
    id: "my-cli-provider",
    title: "My CLI Provider",
    icon: "https://google.com/favicon.ico",
    onUserInput: (req) => fetchMySearchResults(req.query)
    };

    // register home and get back a function to inject search string into home search
    const { setSearchQuery } = await Home.register(myCLIProvider);

    // Store set query function in a map if you're using multiple providers
    searchQueryMap.set(myCLIProvider.id, setSearchQuery);

    // Call the set query function for a specific provider the search should be injected into
    const searchButton = document.createElement('button');
    searchButton.innerHTML = 'Search';
    document.body.appendChild(searchButton);

    searchButton.addEventListener('click', () => {
    searchQueryMap.get('my-cli-provider')('my search string');
    });

Generated using TypeDoc