Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Add ability to clear the queue #8

wants to merge 2 commits into from

3 participants

Brian Cooksey Corey Frang annabellor
Brian Cooksey

Here is the queue removal broken out, per this pull

Corey Frang

Do you think this should call abort on all the requests in the queue?

Corey Frang

Also, could you make sure to add some documentation in the on this? :)


The ability to clear the queue would be very nice.
In my opinion it should clear the entire queue (all the requests).

Brian Cooksey bcooksey Update
Update the docs to describe the clearing functionality
Brian Cooksey

Sorry for the delay on this, it fell off my radar. I could actually see providing an option to clear() that would let the caller decide whether the individual requests should be aborted as well. The particular use case I had for adding it was because i aggressively queued things (on change of a form), and at a certain point, wanted to drop all the pending requests without worrying about any callbacks being triggered.

Corey Frang

This also won't cancel the currently running queue item, which might cause some problems whenever that request finishes, it will end up starting the next queued request and you'll have a concurrency of 2. I think we need .abort() to be able to do this correctly. Though having .clear() to just clear the queue is useful, I'd really prefer to see both together.

Corey Frang

Closing for #13

Corey Frang gnarf closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 18, 2013
  1. Brian Cooksey
Commits on Jul 25, 2013
  1. Brian Cooksey


    bcooksey authored
    Update the docs to describe the clearing functionality
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 0 deletions.
  1. +4 −0
  2. +4 −0 src/jQuery.ajaxQueue.js
@@ -25,9 +25,13 @@ This pluging creates a new method which ensures only one AJAX request is running
### `jQuery.ajaxQueue( options )`
Takes the same options as [jQuery.ajax](, and returns a promise. The return value is not a `jqXHR`, but it will behave like one. The `abort()` method on the returned object will remove the request from the queue if it has not begun, or pass it along to the jqXHR's abort method once the request begins.
+### `jQuery.ajaxQueue.clear()`
+This wil empty the queue. NB: `abort()` is _not_ called on the individual requests in the queue.
## Examples
_(Coming soon)_
## Release History
* v0.1.1 - 2013-01-16
4 src/jQuery.ajaxQueue.js
@@ -43,4 +43,8 @@ $.ajaxQueue = function( ajaxOpts ) {
return promise;
+$.ajaxQueue.clear = function() {
+ ajaxQueue.clearQueue();
Something went wrong with that request. Please try again.