非同期クライアントコールバックのコールバック関数からクライアントコールバックを呼び出すと、コールバック関数が呼ばれ続ける
タイマーなどを利用して回避可能とはいえ、ちょっと困った不具合だ。(既知の不具合だったのですぐに見つかった)
function request_method1() { // ここに GetCallbackEventReference() を callback = "complete_method1", async = true で設定 } function complete_method1(result, context) { // ここに GetCallbackEventReference() を callback = "complete_method2", async = true で設定 alert("complete method1"); } function complete_method2(result, context) { alert("complete method2"); }
とかすると、"complete method1" が20回ぐらい出た後で "complete method2" が20回ぐらいでたりします。再帰を使って次のようなかんじで、サーバ側で発生している長い処理の完了状態を非同期に受け取るようにしたかったんだけど。
function request_progress() { // ここに GetCallbackEventReference() を callback = "display_progress" で設定 } function display_progress(result, context) { $("progress").value = "現在 " + result + " %完了"; if (result < 100) { request_progress(); } }