On Sep 20, 2007 1:22 AM, Maciej Stachowiak <<a href="mailto:mjs@apple.com">mjs@apple.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
FWIW the async model would probably be easier to implement in the<br>short run than worker threads, and we'd be hesitant to implement<br>worker threads at all without a clear spec for which APIs should be<br>available on worker threads. But in the long run I think having both
<br>is reasonable.</blockquote><div><br>Agree.<br></div><div><br>That said, it will be even more common with databases to have multiple asynchronous operations in a row than it is today with XHR. Doing this all asynchronously will be incredibly painful.
<br><br>I have done some thought on how to simplify the worker api, and I think it could be as easy as:<br><br>var w = createWorker("foo.js");<br>w.sendMessage("messageName", jsonStyleObject);<br>w.addEventListener
("messageName", function(e) {<br>  // e.args is a jsonStyleObject that was sent from the worker.<br>}, false);<br><br>Inside the worker:<br><br>worker.addEventListener("messageName", function(e) {<br>  // 
e.args is a jsonStyleObject that was sent from the worker.<br>
}, false);<br>w.sendMessage("messageName", jsonStyleObject);<br>
<br>The main complication then will just be adding back access to the APIs you need: XHR, database, cookies, timers, onerror, etc.<br><br>- a<br></div></div>