Skip to content

Instantly share code, notes, and snippets.

@rudiedirkx
Created October 16, 2011 14:33
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 rudiedirkx/1290931 to your computer and use it in GitHub Desktop.
Save rudiedirkx/1290931 to your computer and use it in GitHub Desktop.
setTimeout arguments polyfill
window.setTimeout(function() {
if ( !arguments.length ) {
// polyfill
var sto = window.setTimeout;
window.setTimeout = function(cb, speed) {
var args = [];
for ( var i=2; i<arguments.length; i++ ) {
args.push(arguments[i]);
}
sto(function() {
cb.apply(null, args);
}, speed);
};
window.setTimeout.polyfilled = true;
}
}, 0, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment