Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface HomeSearchListenerRequest

Representation of a search request from a specific invocation of a HomeProvider's onUserInput listener function.

Hierarchy

Index

Properties

context

context: { isSaved: boolean; isSearchEngines: boolean; isStore: boolean; isSuggestion: boolean; selectedFilters?: CLIFilter[] }

Type declaration

  • isSaved: boolean

    Denotes that this search request should return search results that represent content that a user has saved. (Workspaces, Pages)

  • isSearchEngines: boolean

    Denotes that this search request should return search results that represent other Home search providers. If the user chooses to launch one of these apps, they should register a Home provider.

  • isStore: boolean

    Denotes that this search request should return search results that represents content that is stored in the platform. This should exclude content that the user has saved. (Workspaces, Pages, Views, Apps)

  • isSuggestion: boolean

    Denotes that this Home search request was triggered via the user selecting a suggestion from this provider.

  • Optional selectedFilters?: CLIFilter[]

    any user-selected filters will be populated here e.g [{ title: 'Currency Pairs', type: FilterOptionType.MultiSelect, options: [{ value: 'GBPUSD', isSelected: true}] }]

id

id: string

The ID of the search request. Can be used to tie related search requests together between providers.

query

query: string

The search query.

Optional targets

targets?: string[]

A list of search provider names to execute the search request against.

topic

topic: string

The ID of the topic the search request was dispatched on.

Methods

onClose

  • onClose(listener: () => void): void
  • Registers a listener that is called when the search request is closed by the search requester.

    Can be used to cleanup pending queries:

    async function onUserInput(request) {
    const myQuery = makeQuery(request.query);

    request.onClose(() => {
    myQuery.cancel();
    });

    const results = await myQuery.getResults();
    return { results };
    }

    Parameters

    • listener: () => void

      the listener to call when the request is closed.

        • (): void
        • Returns void

    Returns void

removeListener

  • removeListener(listener: () => void): void
  • Remove a registered listener.


    function myListener(request, listener) {
    // Do something
    }

    request.removeListener(myListener);

    Parameters

    • listener: () => void

      the listener to remove.

        • (): void
        • Returns void

    Returns void

Generated using TypeDoc