Skip to content

Instantly share code, notes, and snippets.

@acnalesso
Created December 7, 2014 14:33
Show Gist options
  • Save acnalesso/e3ad75a7bb89dfee932f to your computer and use it in GitHub Desktop.
Save acnalesso/e3ad75a7bb89dfee932f to your computer and use it in GitHub Desktop.
DeferredActionQueues
flush: function() {
var queues = this.queues;
var queueNames = this.queueNames;
var queueName, queue, queueItems, priorQueueNameIndex;
var queueNameIndex = 0;
var numberOfQueues = queueNames.length;
var options = this.options;
while(queueNameIndex < numberOfQueues) {
queueName = queueNames[queueNameIndex];
queue = queues[queueName];
var numberOfQueueItems = queue._queue.length;
if (numberOfQueueItems === 0) {
queueNameIndex++;
} else {
queue.flush(false, /* async */);
queueNameIndex = 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment