Skip to content

Instantly share code, notes, and snippets.

@ricardotealdi
Created November 9, 2011 20:56
Show Gist options
  • Save ricardotealdi/1352988 to your computer and use it in GitHub Desktop.
Save ricardotealdi/1352988 to your computer and use it in GitHub Desktop.
Javascript dependency injection example
var Calculator = (function () {
"use strict";
function sum(firstNumber, secondNumber) {
return firstNumber + secondNumber;
}
return {
sum : sum
};
}());
var DependencyInjectionExample = (function (calculator) {
"use strict";
function showExample() {
return calculator.sum(1, 3);
}
return {
showExample : showExample
};
}(Calculator));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment