diff --git a/lib/server.js b/lib/server.js index cefedd4..e258629 100644 --- a/lib/server.js +++ b/lib/server.js @@ -71,8 +71,14 @@ server.prototype.errorHandler = function(error){ }; server.prototype.registerPlugin = function(plugin_constructor){ - util.inherits(plugin_constructor, yaps_plugin); - var plugin = new plugin_constructor(this.settings); + var new_plugin = function(options){ + yaps_plugin.call(this, options); + plugin_constructor.call(this, options); + }; + // dont judge me! + util._extend(new_plugin.prototype, yaps_plugin.prototype); + util._extend(new_plugin.prototype, plugin_constructor.prototype); + var plugin = new new_plugin(this.settings); this.enabledPlugins.push(plugin); for(var method in plugin.routes){ this.routes[method] = this.routes[method] || {};