Re:Sleep.js: JavaScript port of PHP sleep() function in 6 LOC
by taf2 on Saturday February 10, 2018 @05:15PM
(#16349956)
This is a really bad idea. CPU burning while you wait. A better approach is setTimeout or requestAnimationFrame.
[ Parent
| on HN ]
Re:Sleep.js: JavaScript port of PHP sleep() function in 6 LOC
by Horlahcoded on Saturday February 10, 2018 @10:58PM
(#16351099)
Why @taf2 ? setTimeout is asynchronous, code after it will be executed before the function...requestAnimationFrame is for animations.