PluginContext
Properties
Environment Variables
MAIN_PLUGIN_REPO
StringDEV_PLUGIN_REPO
StringINTERNAL_PLUGIN_REPO
String__PLUGIN_PREINSTALL_DIR
String__PLUGIN_PREUNINSTALL_FILE
StringCURRENT_API_VERSION
StringCOMPATIBLE_API_VERSIONS
Array<String>
Utilities
app
PluginContext.App - Provides functions to control the appclipboard
PluginContext.Clipboard - Provides electron’s clipboard APItoast
PluginContext.Toast - Provides toast APIshell
PluginContext.Shell - Provides electron’s shell APIlogger
PluginContext.Logger - Provides logging APIlocalStorage
node-persist Object - Provides a storage for each pluginsindexer
PluginContext.Indexer - Provides Indexer API
Preference Objects
globalPreferences
PreferencesObject - Contains Global preferencespreferences
PreferencesObject - Contains Plugin’s own preferences
Example
'use strict';
module.exports = (pluginContext) => {
const app = pluginContext.app;
const toast = pluginContext.toast;
const logger = pluginContext.logger;
function startup() { ... }
function search(query, res) { ... }
function execute(id, payload) {
if (id === '1') {
toast.enqueue('This is message', 1500);
} else if (id == '2') {
app.close();
} else if (id == '3') {
logger.log('this is log');
}
}
return { startup, search, execute };
};