0.0.3 • Published 12 years ago
sire v0.0.3
Sire
JavaScript module husbandry. Base class for modules, such as applications and controllers, that will be responsible for managing the lifecycle of other modules, such as models, views, or child controllers. How modules are started and stopped is determined by the implementing class via
_startand_stopmethods.
Install
With Node.js:
$ npm install sireWith Bower:
$ bower install shannonmoeller/sireWith Component:
$ component install shannonmoeller/sireAPI for Sire Consumers
start( [obj...] ) : Sire
obj...Object(optional)
stop( [obj...] ) : Sire
obj...Object(optional)
use( [name], module ) : Sire
nameString(optional)moduleObject | Function
API for Sire Implementors
_start( module, [options] ) : instance
moduleObject | FunctionoptionsObject(optional)
Note: Implement this function, but do NOT call it directly.
_stop( [instance] )
instanceObject(optional)
Note: Implement this function, but do NOT call it directly.
Example
var Sire = require('sire');
function Foo(options, parent) {
this.options = options || {};
this.parent = parent;
}
function Bar(options, parent) {
this.options = options || {};
this.parent = parent;
}
function App() {
Sire.call(this);
return this
.use(Foo)
.use(Bar)
.start();
}
App.prototype = Object.create(Sire.prototype);
App.prototype.constructor = App;
App.prototype._start = function(Module, options) {
// create instance
return new Module(options, this);
};
App.prototype._stop = function(instance) {
// destroy instance
};
var app = new App();Test
$ npm testLicense
MIT




