Re:An implausibly illustrated introduction to HTML5 Web Workers
by v413 on Monday August 16, 2010 @04:05AM
(#1607162)
In the browser, all DOM events and timers are executed in the main thread along with the html parser, dom layout and rendering, css parsing etc. So if the javascript handling an event takes too long it will block everything else and hence UI responsiveness suffers. With web workers, browser starts a real seperate thread, that will not interrupt the main page thread, hence responsiveness doesn's suffer because of long javascript execution.
[ Parent
| on HN ]
Re:An implausibly illustrated introduction to HTML5 Web Workers
by cubicle67 on Monday August 16, 2010 @08:51AM
(#1607609)
I've got into the (probably bad) habit of using setTimeout(returnMethod,1) as a means of overcoming this. It's especially useful for long scripts that fire in the body onLoad event
Re:An implausibly illustrated introduction to HTML5 Web Workers
by jws on Monday August 16, 2010 @11:33AM
(#1608066)
This works, but the immediate danger I see is that the user can be interacting and triggering other events while you are still acting on the original request. Results will vary from "that's better for them" to "insanity!" depending on what you are doing.
Re:An implausibly illustrated introduction to HTML5 Web Workers
by hoprocker on Monday August 16, 2010 @04:36PM
(#1609132)
AFAIK, you can also get async JS performance by storing your javascript in an external file, then creating a <script> DOM node, setting the 'src' attribute, and appending it to the head/body.
Re:An implausibly illustrated introduction to HTML5 Web Workers
by mike-cardwell on Tuesday August 17, 2010 @04:21AM
(#1610572)
Nope. There's still only a single thread executing all of the javascript on the DOM at any one time.