A lightweight IoC Container for node.
In electronics, a breadboard is a construction base for fast prototyping. You just plug components on it, and connects them to each other. This is what I wanted to reproduce, a simple IoC container so.
## Quick start
First, install the module :
npm install breadboard
Then, you can start using it :
var Breadboard = require("./lib"),
Component = Breadboard.Component,
bb = new Breadboard();
bb.add('foo', Component.new({
method: function() {
return 'Hello world !'
}
}));
bb.add('bar', Component.new(['foo'], {
useFoo: function() {
return this.foo.method();
}
}).on('dependencies:loaded', function(dependencies) {
this.foo = dependencies['foo'];
}));
bb.load();
bb.has('bar'); // => true
var bar = bb.get('bar');
bar.useFoo(); // => 'Hello world !'