I have downloaded an external JavaScript file and want to create a HTML5 User Interface for it. I don't understand why the JavaScript code (see bellow) initiates his main function like that.
//JavaScript Code
(function(Raphael) {
// some codes here
})(window.Raphael);
Why is that function between parentheses?
What does the "window.Raphael" mean?
This is an example of a self invoking anonymous function.
You are passing in window.Raphael into this function which is essentially "renamed" to Raphael inside the function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With