Skip to content

Instantly share code, notes, and snippets.

@umair-me
Last active February 15, 2019 09:56
Show Gist options
  • Save umair-me/2ab4579f48e83d5fd482ba302ac1f186 to your computer and use it in GitHub Desktop.
Save umair-me/2ab4579f48e83d5fd482ba302ac1f186 to your computer and use it in GitHub Desktop.
Creating a javascript file to use in other places
// More details: https://addyosmani.com/resources/essentialjsdesignpatterns/book/#revealingmodulepatternjavascript
// https://stackoverflow.com/a/7513721
var JsApp = (function() {
function callback() {
alert("done");
};
return {
callbackAlert: callback
};
})();
// Usage:
JsApp.callbackAlert();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment