Skip to content

@eriwen /chain.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple function chaining with a timeout (not ES5 compatible)
Array.prototype.chain = function chain(delay) {
var tasks = this, pos = 0, delay = delay || 17;
setTimeout(function() {
tasks[pos++]();
if (pos < tasks.length) setTimeout(arguments.callee, delay);
}, delay);
return this;
};
// Usage;
var tasks = [];
tasks.push(func);
tasks.chain();
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.