PluginContext
Properties
Environment Variables
MAIN_PLUGIN_REPOStringDEV_PLUGIN_REPOStringINTERNAL_PLUGIN_REPOString__PLUGIN_PREINSTALL_DIRString__PLUGIN_PREUNINSTALL_FILEStringCURRENT_API_VERSIONStringCOMPATIBLE_API_VERSIONSArray<String>
Utilities
appPluginContext.App - Provides functions to control the appclipboardPluginContext.Clipboard - Provides electron’s clipboard APItoastPluginContext.Toast - Provides toast APIshellPluginContext.Shell - Provides electron’s shell APIloggerPluginContext.Logger - Provides logging APIlocalStoragenode-persist Object - Provides a storage for each pluginsindexerPluginContext.Indexer - Provides Indexer API
Preference Objects
globalPreferencesPreferencesObject - Contains Global preferencespreferencesPreferencesObject - 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 };
};