Options
All
  • Public
  • Public/Protected
  • All
Menu

Example

'use strict'

module.exports = (pluginContext) => {
    const prefObj = pluginContext.preferences;
    let useProxy = false;

    function onPrefUpdate(pref) {
        useProxy = pref.useProxy;
    }

    function startup() {
        useProxy = prefObj.get('useProxy');
        prefObj.on('update', onPrefUpdate);
    }

    function search(query, res) { ... }
    function execute(id, payload, extra) { ... }

    return { startup, search, execute };
};

Methods

  • get(path?: string): any
  • Returns raw preferences object if path is undefined, otherwise it returns the value at path of object,

    Parameters

    path:  string

    See path rules at @see https://lodash.com/docs#get

    Optional 

    Returns any

  • on(eventName: string, listener: function): void
  • Add a listener to PreferencesObject.

    note:

    Currently, update is the only supported event; it will be emitted when the preference has changed.

    Parameters

    eventName:  string

    The update event is emitted when plugin preferences have changed

    listener:  function

    The call back to be used.

      • (pref: string): void
      • Parameters

        pref:  string

Generated using TypeDoc