Is there a XHR request/response manager for Dojo
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.
精彩评论