Skip to content

Instantly share code, notes, and snippets.

@natemcmaster
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natemcmaster/9554355 to your computer and use it in GitHub Desktop.
Save natemcmaster/9554355 to your computer and use it in GitHub Desktop.
Injector syntax
/// Config.js
Injector.register('GameBoard',GameBoard);
Injector.register('Bank',CrappyBank);
function CrappyBank(data){
}
function GameBoard(data,$Bank,$Traker){
this.bank = $Bank(data);
this.players = $Traker(data);
}
Injector.create = function(name){
dep = registered function for name
for all dollar sign args of dep.constructor:
arg = new Injector.create(arg)
}
function MockBank(data){
}
function TrackerImpl(data,name,$Player){
this.player= $Player(name);
this.data= data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment