I am creating a wrapper, mock sample as follows
var car = function() {
}
car.prototype.method1 = function() {
this.method2();
}
car.protoptype.method2 = function(callback) {
var request = foo() //call to async method
request.onsucces = function() {
this.method3();
});
}
car.protoptype.method3 = function(callback) {
this.method4(); //not found
}
car.protoptype.method4 = function(callback) {
//code
}
//caller
var vehicle = new Car;
vehicle.method1()
My issue is that method 4 isn't called. As its nested in the onsuccess callback, would the 'this' not scope to the object in method 4?