I like the revealing module pattern. I will have private functions that I would like to make public and return them. But I may also have some local functions within my revealing module pattern that "return this"...
var player = function(){
//my local variable scope...
oplayer.damage = function(){
if(!this.grace){
this.shield--;
if (this.shield == 0){
return this;
}
}
};
...
return {
damage : oplayer.damage
}
}();
Is it ok to "return this" if I am explicitly returning something? (in context to using the revealing module pattern). If not, how can I transform my local function oplayer.damage to be used in a proper context? Thanks for any advice! I'm just trying to wrap my mind around the whole "return this" concept.