Created
April 30, 2013 08:21
-
-
Save rendro/5487352 to your computer and use it in GitHub Desktop.
defer wrapper to call a function deferred with a specific context
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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