So, I'd like to have the following construct:
var _class = function() {};
_class.prototype.checkThis = function(callback) {
console.log('this');
};
_class.prototype.checkThat = function(callback){
console.log('that');
};
_class.prototype.validate = function(callback){
var self = this;
this.checkThis(function(err) {
if(!err) self.checkThat(callback);
});
}
var inst = new _class;
inst.validate();
Unfortunately, "this" does not point to the "class" within the callback of "checkThis" such that "checkThat" is unknown. Any ideas?