Skip to content

Instantly share code, notes, and snippets.

@christianschmizz
Created October 20, 2011 13:06
Show Gist options
  • Save christianschmizz/1301095 to your computer and use it in GitHub Desktop.
Save christianschmizz/1301095 to your computer and use it in GitHub Desktop.
Queue
var process = function(queue) {
var data = { stop: false }; // Shared data
(function next() {
if (data.stop) {
$.isFunction(options.stopCallback)
? options.stopCallback(data)
: options.callback(data);
return;
}
if (queue[0]) {
queue.shift().call(queue, data, next);
} else {
options.callback(data);
}
})();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment