Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Simple function queue runner. Just pass me an array of functions and I'll execute them one by one at the given interval.

View simple_function_queue_runner.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// Simple function queue runner. Just pass me an array of functions and I'll
// execute them one by one at the given interval.
run_queue = function (funcs, step, speed) {
step = step || 0;
speed = speed || 500;
funcs = funcs || [];
if (step < funcs.length) {
// execute function
funcs[step]();
// loop it
setTimeout(function () {
run_queue(funcs, step + 1, speed);
}, speed);
}
return;
};

Wooo I like this

Owner

Cool, glad it's useful for someone else too.

Nice one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.