Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arturparkhisenko/79f8a168f698e55fc07c to your computer and use it in GitHub Desktop.
Save arturparkhisenko/79f8a168f698e55fc07c to your computer and use it in GitHub Desktop.
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