Skip to content

Instantly share code, notes, and snippets.

@rendro
Created April 30, 2013 08:21
Show Gist options
  • Save rendro/5487352 to your computer and use it in GitHub Desktop.
Save rendro/5487352 to your computer and use it in GitHub Desktop.
defer wrapper to call a function deferred with a specific context
var defer = function (cb, t, ctx) {
t = t || 0;
ctx = ctx || this;
return function () {
var args = Array.prototype.slice.call(arguments);
setTimeout(function() {
cb.apply(ctx, args);
}, t);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment