Forked from carldanley/facade-pattern-example-2.js
Last active
September 3, 2015 11:39
-
-
Save arturparkhisenko/79f8a168f698e55fc07c to your computer and use it in GitHub Desktop.
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
var MyModule = ( function( window, undefined ) { | |
// revealing module pattern ftw | |
function MyModule() { | |
function someMethod() { | |
alert( 'some method' ); | |
} | |
function someOtherMethod() { | |
alert( 'some other method' ); | |
} | |
// expose publicly available methods | |
return { | |
// in our normal revealing module pattern, we'd do the following: | |
someMethod : someMethod, | |
// in the facade pattern, we mask the internals so no one has direct access by doing this: | |
someMethod : function() { | |
someMethod(); | |
} | |
}; | |
} | |
} )( window ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment