|
|
|
|
|
by jeresig
6172 days ago
|
|
I don't really understand what you're upset about - you don't like how they look and you're worried that they're a hack? Are you familiar with the current situation of processing in JavaScript? It involves running chunks of code, split up using delayed timers, that constantly block the user interface from being usable. If you want to talk about something that doesn't look good and is hacky - that's what you should be railing against. |
|
IMHO it'd be far nicer just to speed js up and perhaps create some helper functionality to aid in splitting chunks of work up into bite size pieces, and make it more optimal.
It'd be much nicer to just have some yield statement which allows you to say "Hey, it's ok if you process any pending UI events, timers etc etc here". That way you could just have a single main loop with some yields in the right places. It'd create simpler, more maintainable code, and there's no reason it'd be slower or less responsive UI wise than the web worker version.
I can see the examples where web workers can be useful, where you're doing really CPU heavy backgroud work such as image processing etc. But I think people will end up using web workers for far more than that, which will make for some ugly code (IMHO).