webgme-engine
Version:
WebGME server and Client API without a GUI
66 lines (55 loc) • 2.16 kB
JavaScript
/*globals define*/
/*eslint-env node, browser*/
/**
* Generated by PluginGenerator 1.7.0 from webgme on Mon Jan 16 2017 10:17:00 GMT-0600 (Central Standard Time).
* A plugin that inherits from the PluginBase. To see source code documentation about available
* properties and methods visit %host%/docs/source/PluginBase.html.
*/
define([
'plugin/PluginConfig',
'text!./metadata.json',
'plugin/PluginBase'
], function (
PluginConfig,
pluginMetadata,
PluginBase) {
'use strict';
pluginMetadata = JSON.parse(pluginMetadata);
/**
* Initializes a new instance of CustomPluginConfig.
* @class
* @augments {PluginBase}
* @classdesc This class represents the plugin CustomPluginConfig.
* @constructor
*/
var CustomPluginConfig = function () {
// Call base class' constructor.
PluginBase.call(this);
this.pluginMetadata = pluginMetadata;
};
/**
* Metadata associated with the plugin. Contains id, name, version, description, icon, configStructue etc.
* This is also available at the instance at this.pluginMetadata.
* @type {object}
*/
CustomPluginConfig.metadata = pluginMetadata;
// Prototypical inheritance from PluginBase.
CustomPluginConfig.prototype = Object.create(PluginBase.prototype);
CustomPluginConfig.prototype.constructor = CustomPluginConfig;
/**
* Main function for the plugin to execute. This will perform the execution.
* Notes:
* - Always log with the provided logger.[error,warning,info,debug].
* - Do NOT put any user interaction logic UI, etc. inside this method.
* - callback always has to be called even if error happened.
*
* @param {function(null|Error, plugin.PluginResult)} callback - the result callback
*/
CustomPluginConfig.prototype.main = function (callback) {
var currentConfig = this.getCurrentConfig();
this.createMessage(this.activeNode, 'Name of active node is [' + currentConfig.activeNodeName + ']');
this.result.setSuccess(true);
callback(null, this.result);
};
return CustomPluginConfig;
});