Your plugin developer could require your base prototype in their code, tune it up with own logic, and return as module.exports object - it's wide adopted pattern.
On 27.02.2012, at 5:20, 0x80 <[email protected]> wrote: > Hi there, > > I'm about to port some code to nodejs and it involves some sort host > with a user plugin system. I'm not sure what the best approach is so I > thought I'd ask for some feedback and advice here. > > The host environment lets the user create a plugin with only a few > functions exposed to the outside. The plugin should inherit from a > base containing required modules and functions to keep the client code > to a minimum. > > I was planning to create a plugin prototype for the base > functionality, and let the user define its plugin in a module. In the > module the user would inherit an object from the prototype, extend its > functionality, and then export a constructor which returns the plugin > object. > > The main system loads all plugins by require("pluginname") and for > each calls the constructor. > > Does it make sense to use the module system for such a thing? Or do > you suggest a different approach? > > Cheers, > Thijs > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
