[whatwg] Passing more than JSON data to workers
jan.fabry at monkeyman.be
Wed Dec 16 09:23:36 PST 2009
Has it been considered to pass more than JSON data to workers? I could not find a rationale behind this in the FAQ, or in other places I looked. I understand the need for separation because of concurrency issues, but aren't there other ways to accomplish this?
(The following text was already posted to the forum, but "zcorpan" suggested I also post it here)
[ http://forums.whatwg.org/viewtopic.php?t=4185 ]
Would it be possible to do a deep copy of the function (object) you pass to the the constructor? So copy everything (or mark it for copy-on-write), but remove references to DOM elements if they exist. This way, I think you can create a parallel data structure, so the original one remains untouched (avoiding concurrency issues).
The Google Gears API seems to provide both createWorker(scriptText) and createWorkerFromUrl(scriptUrl). Why was only the URL variant retained in the Web Workers spec? With the script variant, there would have been at least a little basis for more dynamic programming.
More information about the whatwg