Skip to content

Instantly share code, notes, and snippets.

@ljharb
Forked from anonymous/Function.prototype.within.js
Created December 15, 2012 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljharb/4291523 to your computer and use it in GitHub Desktop.
Save ljharb/4291523 to your computer and use it in GitHub Desktop.
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(function () { that.apply(null, args); }, millis); );
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment