News for hackers. Stuff that matters.
Re:Javascript asynchronous problems by aa0 on Monday August 19, 2013 @06:31AM (#6236445)
Timeouts are not checked on every event loop, hence the 4ms delay. And no, setTimeout is asynchronous and processed during the event loop.

Basic event loop is; timeouts, js execution, repaint, reflow, etc

Re:Javascript asynchronous problems by lewispollard on Monday August 19, 2013 @06:50AM (#6236488)
What I mean to say is, what's the practical difference between running setImmediate(doSomething) and just calling doSomething() in its place if setImmediate blocks the execution anyway, is there some kind of special use that would make it useful?
Re:Javascript asynchronous problems by aa0 on Monday August 19, 2013 @07:46AM (#6236658)
Yes, render,reflow,timeouts,event handling, etc happens.. You might need to set a CSS property and then animate it. In this case you'll need to wait for a render in between the two steps

Also useful if you need to wait until after all event handlers are executed in the current context

Re:Javascript asynchronous problems by lewispollard on Monday August 19, 2013 @08:12AM (#6236753)
Gotcha, thanks for the explanation!