在promise挂起时延迟执行的回调函数
Callback of deferred to be executed while promise is pending
如何配置代码在等待jQuery.Deferred
承诺时运行?就像:
$.when(someAJAX).whatever(function() {
// run this while the AJAX is loading
}).done(function() {
// run this when it is done
});
我已经检查了文档,并没有发现任何东西,但也许我错过了一些东西(deferred.progress()
在这里不起作用)
我认为你想要的比你想要做的要简单得多。相反,您可以这样做:
$.when.apply($, arrayOfPromises).done(function() {
// code here when ajax call is done
});
// this code will execute right after the ajax call was initiated
// put code here to set state while ajax is loading
相关文章:
- JavaScript回调函数
- 如何在回调函数中执行流
- 回调函数中传递参数的困难(Google Map API Markers)
- 如何正确地将参数传递给RequireJS回调函数
- 回调函数在python代码中离线
- 从AJAX回调函数中分离数据
- 赋值后的回调函数
- 如何在javascript回调函数中返回多个变量
- 函数表达式,返回回调函数
- 等待回调函数执行
- JavaScript回调函数和Google Feed API
- 如何从ajax成功回调函数中读取javascript变量
- 正在保存JavaScript内部回调函数中的值
- 有没有什么方法可以停止Jquery中的animate(也可以停止完整的回调函数)
- 如何在javascript中添加带有回调函数的按钮点击事件作为window.conf
- 在Golang回调函数中启用CORS
- 在初始函数完成之前调用回调函数
- jQuery Mobile:如何在$.Mobile.changePage之前运行回调函数
- 即使使用回调函数也无法返回值
- 为什么prototypjs观察到回调函数有绑定