I have a code that looks like this:
function program(){
this.bye = function(){
//some code
return this;
}
this.hello = function(){
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(geoSuccess,geoError);
}
return this;
}
if(this instanceof program()){
return this.program;
} else {
return new program();
}
}
var PR = new program();
My question is this: How can I accomplish a chain execution such as:
TB.hello().bye();
and execute bye() when the geolocation response arrives.
I would like to keep the chain execution without having to execute .bye() from inside geoSuccess function. Is there any way to accomplish this ?