関数のチェーンの 1 つにポップアップ ウィンドウの待機が含まれる場合、一連の関数を順次実行するにはどうすればよいですか?
以下のauthBegin
関数では、完了すると関数に戻るウィンドウをポップアップしていますauthBegin
。
しかし、連鎖はもちろんそれを待っているわけではありません。ウィンドウが戻るまで待機させるにはどうすればよいですか?
am.authUnlessCurrent().authBegin().collectData();
var authModule=function(){
this.authUnlessCurrent=function(){
alert("checks auth");
};
this.authBegin=function(){
window.oauth_success = function(userInfo) {
popupWin.close();
return this;
}
window.oauth_failure = function() {
popupWin.close();
return true;
}
popupWin = window.open('/auth/twitter');
};
this.collectData=function(){
alert("collect data");
return this;
};
}