Skip to content

Instantly share code, notes, and snippets.

@aramk
Created July 28, 2012 03:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aramk/3191662 to your computer and use it in GitHub Desktop.
Save aramk/3191662 to your computer and use it in GitHub Desktop.
JavaScript Module Pattern
// 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