Last active
August 29, 2015 13:59
-
-
Save dervalp/10850643 to your computer and use it in GitHub Desktop.
IOC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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