开发者

Is there a XHR request/response manager for Dojo

开发者 https://www.devze.com 2023-01-20 00:04 出处:网络
I was wondering if Dojo (or any of its extensions) provides a (reliable) XHR request/response manager that would allow me to queue, block and retry calls when needed. Something similar to AJAX Queue/C

I was wondering if Dojo (or any of its extensions) provides a (reliable) XHR request/response manager that would allow me to queue, block and retry calls when needed. Something similar to AJAX Queue/Cache/Abort/Block Manager v. 3.0 for开发者_StackOverflow中文版 jQuery.


Yes there is, Dojo deferred. Any i/o - ajax calls (xhrPut/xhrPost/xhrGet etc..) returns a deferred call, you can add them into a list of deferred calls, and if you want, independently from the success of failure you can call a function.

i.e. var deferred = dojo.xhrPost({...});

deferred.addCallback(function(data) { ...}); // it execute independetly from success or failure

look at here this is an example of xhrPost, if you look at the code it says that returns a deferred object.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号