AjaxQueue - Voliware/AjaxPlus GitHub Wiki

No Budding

When you need your requests to go in order, you use AjaxQueue.

// create a queue that only allows
// 25 requests to be enqueued and only one to be active
var queue = new AjaxQueue({
   size : 25,
   activeRequestLimit : 1
})
.enqueue(Server.requestOne, Server.requestTwo)
.enqueue([requests]);

The requests will be dequeued immediately after they are queued, meaning the queue is always flushed. You can also set the timeout option to set a timeout in between each request's always event. The next request will run on done or fail, unless the abortOnFail option is set to true; in that case, the rest of the queue is abandoned.