Skip to content

Instantly share code, notes, and snippets.

@AimeeKnight
Created October 17, 2013 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AimeeKnight/7030693 to your computer and use it in GitHub Desktop.
Save AimeeKnight/7030693 to your computer and use it in GitHub Desktop.
JavaScript Revealing Module Pattern
var jspy = (function() {
var _count = 0;
var incrementCount = function() {
_count++;
};
var resetCount = function() {
_count = 0;
};
var getCount = function() {
return _count;
};
return {
add: incrementCount,
reset: resetCount,
get: getCount
};
})();
jspy.get(); // 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment