Skip to content

Instantly share code, notes, and snippets.

@ms2sato
Last active December 17, 2015 11:39
Show Gist options
  • Save ms2sato/5603535 to your computer and use it in GitHub Desktop.
Save ms2sato/5603535 to your computer and use it in GitHub Desktop.
最近やっているClassの書き方です。
var MyClass = (function(){
function MyClass(){}
MyClass.prototype.doIt = function(a, b){
console.log('doIt');
this._doProtected();
privates.doSecret.call(this, a, b);
};
MyClass.prototype._doProtected = function(){
//protected
console.log('protected');
}
var privates ={
doSecret: function(){
//private
console.log('private');
}
};
return MyClass;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment