Skip to content
This repository was archived by the owner on Aug 23, 2019. It is now read-only.

shannonmoeller-archive/sire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 _start and _stop methods.

Build Status NPM version Dependency Status Bitdeli Badge

Install

With Node.js:

$ npm install sire

With Bower:

$ bower install shannonmoeller/sire

With Component:

$ component install shannonmoeller/sire

API for Sire Consumers

start( [obj...] ) : Sire

  • obj... Object (optional)

stop( [obj...] ) : Sire

  • obj... Object (optional)

use( [name], module ) : Sire

  • name String (optional)
  • module Object | Function

API for Sire Implementors

_start( module, [options] ) : instance

  • module Object | Function
  • options Object (optional)

Note: Implement this function, but do NOT call it directly.

_stop( [instance] )

  • instance Object (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 test

Browser Support

License

MIT

About

JavaScript module husbandry. **Unmaintained**

Resources

Stars

0 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors