Created
July 28, 2012 03:35
-
-
Save aramk/3191662 to your computer and use it in GitHub Desktop.
JavaScript Module Pattern
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
// My take on the JavaScript module pattern | |
// By Aram Kocharyan, 2012. | |
// http://ak.net84.net/ | |
(function($) { | |
window.moduleName = new function() { | |
var base = this; | |
// Internally visible | |
var pvt = '123'; | |
// Externally visible | |
base.init = function() { | |
console.log('init'); | |
}; | |
}; | |
})(jQuery); | |
console.log(moduleName.init); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment