Lightweight application extensibility and composition with a twist of feature reflection.
var broadway = require('broadway');
var app = new broadway.App();
// Attach some plugin to app
app.use(require('./plugins').);
app.init(function (err) {
});
Lorem ipsum
Initialize application and it's plugins, callback
will be called with null or
initialization error as first argument.
Attach plugin to application. plugin
should conform to following interface:
var plugin = {
"name": "example-plugin", // Plugin's name
"attach": function attach(options) {
// Called with plugin options once plugin attached to application
// `this` - is a reference to application
},
"detach": function detach() {
// Called when plugin detached from application
// (Only if plugin with same name was attached)
// `this` - is a reference to application
}
"init": function init(callback) {
// Called on application initialization
// App#init(callback) will be called once every plugin will call `callback`
// `this` - is a reference to application
}
};
See EventEmitter2 documentation for more information.
$ curl http://npmjs.org/install.sh | sh
$ [sudo] npm install broadway
All tests are written with vows and should be run with npm:
$ npm test