Created
March 20, 2014 20:29
-
-
Save vojtajina/9673132 to your computer and use it in GitHub Desktop.
Annotations in ES5
This file contains hidden or 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
// helper function, we can even ship these | |
define(['di/annotations'], function(annotations) { | |
var Inject = annotations.Inject; | |
var annotate = annotations.annotate; | |
return function inject(fn) { | |
var deps = Array.prototype.slice.call(arguments, 1); | |
var annotation = new Inject(); | |
Inject.apply(annotation, deps); | |
annotate(fn, annotation); | |
}; | |
}); |
This file contains hidden or 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
define(['./inject-helper', 'foo'], function(inject, Foo) { | |
inject(MyController, Foo); | |
function MyController(foo) { | |
// ... | |
} | |
return MyController; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment