Skip to content

Instantly share code, notes, and snippets.

Created December 15, 2012 05:27
Show Gist options
  • Save anonymous/4291515 to your computer and use it in GitHub Desktop.
Save anonymous/4291515 to your computer and use it in GitHub Desktop.
Setting up a function call within a given count of milliseconds.
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