Last active
June 25, 2016 06:59
-
-
Save borsch/9651e95e5a6837e38d9f0994a62e78f7 to your computer and use it in GitHub Desktop.
js separate file
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
// script.js | |
(function(exports){ | |
// public function | |
// can be accessed outside of this file | |
exports.publicFunction = function(param1, param2){ | |
}; | |
// private function | |
// visible only inside this function(closure) | |
function privateFunction(){ | |
} | |
})(window); | |
// page.jsp | |
.. | |
<script src="/path/to/file/script.js"></script> | |
<script> | |
publicFunction(${someParamFromModel}, otherParam); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment