Skip to content

Instantly share code, notes, and snippets.

@devdays
Created December 7, 2014 19:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save devdays/d68a150ac015dc9a7624 to your computer and use it in GitHub Desktop.
Object JavaScript - Revealing Module Pattern
var Module = (function() {
// All functions now have direct access to each other
var privateFunc = function() {
publicFunc1();
};
var publicFunc1 = function() {
publicFunc2();
};
var publicFunc2 = function() {
privateFunc();
};
// Return the object that is assigned to Module
return {
publicFunc1: publicFunc1,
publicFunc2: publicFunc2
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment