次のようなコードがあります。
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();
私の質問は次のとおりです。次のようなチェーン実行をどのように達成できますか:
TB.hello().bye();
ジオロケーション応答が到着したら bye() を実行します。
geoSuccess 関数内から .bye() を実行しなくても、チェーンの実行を維持したいと思います。これを達成する方法はありますか?