Created
March 17, 2013 15:56
-
-
Save anonymous/5182152 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 CLASSNAME = (function(self){ | |
var _private = 0; | |
function __init(){ | |
//run self init stuff here | |
} | |
function returnPrivate(){ | |
return _private; | |
} | |
function fnAdd(num){ | |
_private+= num; | |
return returnPrivate(); | |
} | |
function fnSubstract(num){ | |
_private-= num; | |
return returnPrivate(); | |
} | |
__init(); | |
return { | |
fnAdd : fnAdd, | |
fnSubstract : fnSubstract | |
} | |
})(CLASSNAME || {}); | |
//ForExample call CLASSNAME.fnAdd(2). Keep calling it and you will see the private keep changing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Module revealing pattern, with Augmentation