add api registration to plugin

This commit is contained in:
Iuri Matias 2018-03-13 06:23:12 -04:00 committed by Pascal Precht
parent 09390276bc
commit 8b261cbc04
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 8 additions and 0 deletions

View File

@ -23,6 +23,7 @@ var Plugin = function(options) {
this.dappGenerators = []; this.dappGenerators = [];
this.pluginTypes = []; this.pluginTypes = [];
this.uploadCmds = []; this.uploadCmds = [];
this.apiCalls = [];
this.imports = []; this.imports = [];
this.embarkjs_code = []; this.embarkjs_code = [];
this.embarkjs_init_code = {}; this.embarkjs_init_code = {};
@ -223,6 +224,11 @@ Plugin.prototype.registerActionForEvent = function(eventName, cb) {
this.addPluginType('eventActions'); this.addPluginType('eventActions');
}; };
Plugin.prototype.registerAPICall = function(method, endpoint, cb) {
this.apiCalls.push({method: method, endpoint: endpoint, cb: cb});
this.pluginTypes.push('apiCalls');
};
Plugin.prototype.runFilePipeline = function() { Plugin.prototype.runFilePipeline = function() {
var self = this; var self = this;

View File

@ -45,6 +45,7 @@ Plugins.prototype.createPlugin = function(pluginName, pluginConfig) {
interceptLogs: this.interceptLogs, interceptLogs: this.interceptLogs,
events: this.events, events: this.events,
config: this.config, config: this.config,
//plugins: this,
isInternal: true, isInternal: true,
context: this.context context: this.context
}); });
@ -65,6 +66,7 @@ Plugins.prototype.loadInternalPlugin = function(pluginName, pluginConfig) {
interceptLogs: this.interceptLogs, interceptLogs: this.interceptLogs,
events: this.events, events: this.events,
config: this.config, config: this.config,
//plugins: this.plugins,
isInternal: true, isInternal: true,
context: this.context, context: this.context,
env: this.env env: this.env