Created
May 20, 2013 20:49
-
-
Save tonydub/13e0d5befa864a58bbb6 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 myRevealingModule = function () { | |
var privateCounter = 0; | |
function privateFunction() { | |
privateCounter++; | |
} | |
function publicFunction() { | |
publicIncrement(); | |
} | |
function publicIncrement() { | |
privateFunction(); | |
} | |
function publicGetCount(){ | |
return privateCounter; | |
} | |
// Reveal public pointers to | |
// private functions and properties | |
return { | |
start: publicFunction, | |
increment: publicIncrement, | |
count: publicGetCount | |
}; | |
}(); | |
myRevealingModule.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment