My favorites | Sign in
Project Logo
                
Code license: New BSD License
Labels: JavaScript, DIContainer, AOP
Feeds:
People details
Project owners:
  masaya.yamauchi

ContainerJS

ContainerJS is a Light weight Dependency Injection Contaier for JavaScript, supports AOP (aspect oriented programming).

Features:

Usage

<script type="text/javascript" src="../container.js" ></script>
var stdout = document.getElementById( "stdout" );

// class
function Kitten() {}
Kitten.prototype = {
   getName: function () { return this.name; }
};

// create container. 
var c = new container.Container( function( binder ) {  
  // bind component "mii" to a kittten class, 
  // and inject "mii" to a name property of component "mii". 
  binder.bind( Kitten ).to( "mii" ).inject( { "name": "mii" } ); 
});

// getting component "mii" from container.
var mii = c.get( "mii" );
stdout.innerHTML += mii.getName(); // mii








Hosted by Google Code