This project is archived and is in readonly mode.
Request.Queue should have a method for sending all requests
Reported by kmike | March 21st, 2011 @ 03:14 PM
There is no method on queue object that just sends all requests.
My use case: I want to load data from several json resources and run a function when the data is loaded.
queue.runAll() seems to be not useful in this case because it only runs 'queued' requests, requests are queued by calling 'send' on them, and there is no need to call queue.runAll after that (because autoAdvance is True by default?)
Example with some comments: http://jsfiddle.net/kmike/Eya9g/
Comments and changes to this ticket
Why not just something like.
var requests = [request1, request2, ...].invoke('send');
Yes, you're right, my code can be simplified.
But it is still unintuitive that:
1) In order to run a queue a separate list of requests is required (they can't be defined inline as in example). Alternatively, code can rely on undocumented queue.requests property (I wasn't sure it is correct property before reading all the Request.Queue code).
2) queue.runAll() doesn't run requests passed to Request.Queue constructor or added by addRequest/addRequests methods. It does nothing in almost all practical use cases.