Created
December 15, 2012 05:27
-
-
Save anonymous/4291515 to your computer and use it in GitHub Desktop.
Setting up a function call within a given count of milliseconds.
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
Function.prototype.within = function (millis) { | |
var that = this; | |
return function () { | |
var args = Array.prototype.slice.call(arguments); // if sinful present, slice(arguments) | |
return window.setTimeout(that, millis, args); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment