Skip to content

Instantly share code, notes, and snippets.



Forked from ngauthier/settimeout.js
Last active Aug 29, 2015
What would you like to do?
// if we have
function do() {
// thing that takes 100ms - 2s depending on browser
// Instead of:
setInterval(do, 500) // pray it doesn't lock the browser
// Do this:
function doAndTick() {
setTimeout(doAndTick, 100);
// It will not run exactly every 500, but it guarantees 100ms of downtime for the browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.