Skip to content

Instantly share code, notes, and snippets.

@dervalp
Last active August 29, 2015 13:59
Show Gist options
  • Save dervalp/10850643 to your computer and use it in GitHub Desktop.
Save dervalp/10850643 to your computer and use it in GitHub Desktop.
IOC
var toto = function (name, $Provider) {
//will be an EntityService
//name is test
};
toto.$DataProvider = "";
IOC.register("Toto")
.define( toto )
.inject({ name: "Test" })
.singleton();
IOC.register("EntityService")
.define( function () {
} )
.singleton();
IOC.when( "Provider" )
.use( "EntityService" );
IOC.when( "DataProvider" )
.use( "EntityService" );
var totoService = IOC.create( "Toto" );
//totoService.$DataProvider is an EntityService
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment