Hacker News new | ask | show | jobs
Sleep.js: JavaScript port of PHP sleep() function in 6 LOC (github.com)
2 points by devhammed 3055 days ago
2 comments

This is a really bad idea. CPU burning while you wait. A better approach is setTimeout or requestAnimationFrame.
Why @taf2 ? setTimeout is asynchronous, code after it will be executed before the function...requestAnimationFrame is for animations.
Why?