Created
November 9, 2011 20:56
-
-
Save ricardotealdi/1352988 to your computer and use it in GitHub Desktop.
Javascript dependency injection example
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 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