Very common approach.

Sent from my Windows Phone
From: 0x80
Sent: 2/27/2012 3:41 AM
To: nodejs
Subject: [nodejs] Use modules as plugins
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

Reply via email to