Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface SearchListenerResponse

Representation of a search response from a specific invocation of a SearchProvider's onUserInput listener function. Can optionally be used to push search results to the requester.

function onUserInput(searchListenerRequest, searchListenerResponse) {
searchListenerResponse.open();

const myLongRunningQuery = makeMyLongRunningQuery(searchListenerRequest.query);
myLongRunningQuery.onNewResults(myNewResults => {
searchListenerResponse.respond(myNewResults);
});

searchListenerRequest.onClose(() => {
myLongRunningQuery.close();
});
}

Hierarchy

  • SearchListenerResponse

Index

Methods

  • close(): void
  • Close the response stream. This notifies the requester that the current search provider is done sending results.

    import type { SearchListenerResponse } from './my-shape-definition';
    function closeStream(request:SearchListenerRequest, response:SearchListenerResponse) {
    response.close();
    }

    closeStream();
    experimental

    Returns void

  • open(): void
  • Open the response stream, notifying the search requester that there are new or updated search results that have yet to be pushed by the current provider.

    experimental
    import type { SearchListenerResponse } from './my-shape-definition';
    function openStream(response:SearchListenerResponse) {
    response.open();
    }

    openStream();

    Returns void

  • Respond to the search request with new or updated search results.


    response.respond([
    { name: 'result-1' },
    { name: 'result-2' },
    { name: 'result-3' },
    ]);
    experimental

    Parameters

    Returns void

  • revoke(...resultKeys: string[]): void
  • Remove a search result from the list of responded search results.

    response.revoke({ name: 'result-1' }, { name: 'result-2' });
    
    experimental

    Parameters

    • Rest ...resultKeys: string[]

      the keys of the search results to revoke.

    Returns void

Generated using TypeDoc