Skip to content

Instantly share code, notes, and snippets.

@remy
Created April 8, 2010 14:24
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save remy/360113 to your computer and use it in GitHub Desktop.
Save remy/360113 to your computer and use it in GitHub Desktop.
setInterval run once, then keep running
setInterval((function () {
console.log(new Date()); // run some arbitrary code
return arguments.callee; // here be the magic
})(), 1000);
// ^---- and that runs the function, and the return val is assign to the interval
@paulirish
Copy link

Accessing the arguments object is very slow.
http://www.jspatterns.com/arguments-considered-harmful/
http://webreflection.blogspot.com/2010/02/arguments-callee-call-and-apply.html

@getify, i'm aware of the NFE scope leaking bugs in IE, but not any memory leaks..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment