简体   繁体   English

有关AJAX承诺/推迟的帮助

[英]Help with AJAX Promises/Deferred

I'm looking for a small JS library for Promises/Defers for multiple AJAX requests that I can use with MooTools. 我正在寻找一个小型的JS库,用于可用于MooTools的多个AJAX请求的Promises / Defers。 All of the ones that I can find all have setTimeout functions as their examples, which don't show me how I can use the resulting JSON and/or HTML in the Deferred callback that is fired when all of the requests are finished. 我可以找到的所有示例都具有setTimeout函数,这些示例都没有向我展示如何在所有请求完成后触发的Deferred回调中使用生成的JSON和/或HTML。

Can anyone point me in the right direction? 谁能指出我正确的方向?

不知道您是否正在寻找一个小的Deferred实现,例如https://gist.github.com/3672350

if it's a queue of requests, have you looked at either using this: http://mootools.net/docs/more/Request/Request.Queue or extending it somewhat? 如果是请求队列,您是否使用过以下方法: http : //mootools.net/docs/more/Request/Request.Queue还是对其进行了扩展?

the difference between deferred normal tasks (that are sync) and deferred async is in that you need to intercept the onComplete events of the requests to notify the task handler that it's finished and then pass them on to the original onComplete assigned. 延迟的常规任务(同步)和延迟的异步之间的区别在于,您需要拦截请求的onComplete事件,以通知任务处理程序已完成,然后将其传递给分配的原始onComplete。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM