Skip to content

Instantly share code, notes, and snippets.

@ClaudiuCreanga
Created February 9, 2017 14:15
Show Gist options
  • Save ClaudiuCreanga/4e9bc648a365a22c0225837cc55eda30 to your computer and use it in GitHub Desktop.
Save ClaudiuCreanga/4e9bc648a365a22c0225837cc55eda30 to your computer and use it in GitHub Desktop.
setInterval() <-issues because sometimes it doesn’t finish before the next function starts. To solve it make setTimeout call itself:
(function(){
doStuff();
setTimeout(arguments.callee,100)
}()
arguments.callee to refer to the currently executing function
or better:
(function names(){
doStuff();
setTimeout(names,100)
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment