Last active
February 15, 2019 09:56
-
-
Save umair-me/2ab4579f48e83d5fd482ba302ac1f186 to your computer and use it in GitHub Desktop.
Creating a javascript file to use in other places
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
// 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