Last active
August 8, 2016 12:06
-
-
Save razwan/226a27e89ec02b2760d83d1b41c590bd to your computer and use it in GitHub Desktop.
JavaScript Revealing Module Design Pattern
This file contains hidden or 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
;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