tazrover / broadway

Lightweight application extensibility and composition with a twist of feature reflection.

Home Page:http://github.com/flatiron/broadway

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

broadway

Lightweight application extensibility and composition with a twist of feature reflection.

Example

var broadway = require('broadway');

var app = new broadway.App();

// Attach some plugin to app
app.use(require('./plugins').);

app.init(function (err) {
});

Motivation

Lorem ipsum

API

App#init(callback)

Initialize application and it's plugins, callback will be called with null or initialization error as first argument.

App#use(plugin, options)

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
  }
};

App#on(event, callback) and App#emit(event, data)

See EventEmitter2 documentation for more information.

Installation

Installing npm (node package manager)

  $ curl http://npmjs.org/install.sh | sh

Installing broadway

  $ [sudo] npm install broadway

Tests

All tests are written with vows and should be run with npm:

  $ npm test

License: MIT

About

Lightweight application extensibility and composition with a twist of feature reflection.

http://github.com/flatiron/broadway

License:MIT License