Skip to content

Instantly share code, notes, and snippets.

@guo-yu
Created November 24, 2013 17:11
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 guo-yu/7629574 to your computer and use it in GitHub Desktop.
Save guo-yu/7629574 to your computer and use it in GitHub Desktop.
a simple dependency injector example
var Depender = require('depender');
dep = new Depender;
dep.define('text', '123');
dep.define('text2', 'demo222222');
dep.define('functionOne', function(msg) {
console.log(msg);
});
dep.use(function(text2, text, functionOne, nonce) {
console.log(text2);
console.log(text);
functionOne('hi, im a function!');
console.log(nonce) // undefined
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment