Skip to content

Instantly share code, notes, and snippets.

@razwan
Last active August 8, 2016 12:06
Show Gist options
  • Save razwan/226a27e89ec02b2760d83d1b41c590bd to your computer and use it in GitHub Desktop.
Save razwan/226a27e89ec02b2760d83d1b41c590bd to your computer and use it in GitHub Desktop.
JavaScript Revealing Module Design Pattern
;var Module = (function(undefined) {
var privateVariable = '';
function privateMethod() {
console.log('did this');
}
function exposedMethod() {
privateMethod();
}
function anotherExposedMethod() {
console.log('did that');
}
return {
publicMethod: exposedMethod,
otherPublicMethod: anotherExposedMethod
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment