'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 }; };
Returns raw preferences object if path is undefined, otherwise it returns the value at path of object,
See path rules at @see https://lodash.com/docs#get
Add a listener to PreferencesObject.
Currently, update is the only supported event; it will be emitted when the preference has changed.
update
The update event is emitted when plugin preferences have changed
The call back to be used.
Generated using TypeDoc
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 }; };