Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
All you need to manage queues
function Queue(q) {"use strict";
// (C) WebReflection - Mit Style License
var
next = function next() {
return (callback = q.shift()) ? !!callback(q) || !0 : !1;
},
callback
;
(q.wait = function wait(condition, delay) {
condition || callback && q.unshift(callback);
setTimeout(q.next = next, delay || 0);
})(1);
return q;
}
@WebReflection

This comment has been minimized.

Copy link
Owner Author

@WebReflection WebReflection commented Mar 15, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment