Options
All
  • Public
  • Public/Protected
  • All
Menu

These are the functions your plugin may implement

Your plugin should return an object with references to the implemented functions.

Note that your exported function is receiving an argument of pluginContext.

Example

'use strict';

module.exports = (pluginContext) => {
    function startup() {
        // You can do any initialization here
    }

    function search(query, res) {
        // You can return your search results here
    }

    function execute(id, payload, extra) {
        // When your result is selected, you can run something here
    }

    function renderPreview(id, payload, render) {
        // You can render preview with HTML
    }

    return { startup, search, execute, renderPreview };
};

Methods

  • execute(id: any, payload: any, extra: ExecuteData): void Optional
  • This function will be invoked when user executes an item you send in the search function.

    Parameters

    id:  any

    id of the selected SearchResult or IndexedResult

    payload:  any

    payload of the selected SearchResult or IndexedResult

    extra:  ExecuteData

    Contains extra information passed from hain when the execute event ocurred

  • renderPreview(id: any, payload: any, render: function): void Optional
  • If present, is called when an SearchResult or IndexedResult is selected from the list and that result included a preview value.

    Parameters

    id:  any

    id of the selected SearchResult or IndexedResult

    payload:  any

    payload of the selected SearchResult or IndexedResult

    render:  function

    Call this function with html to be rendered in the preview area

      • (html: string): void
      • Parameters

        html:  string
  • This function will be invoked when user changes their query. This will be called every 30ms maximum.

    since

    v0.6 search() is only called when the query begins with your package.json prefix value

    Parameters

    query:  string

    The query the user has input so far

    res:  ResponseObject

    The results of the query should be added to this object

  • startup(): void Optional
  • This function will be invoked once at startup. Use promises and asynchronous calls to avoid long load times.

Generated using TypeDoc