Wednesday, June 23rd, 2010
Rick Waldron has detailed the SharedWorker support that Opera has added in 10.6 beta (and has been available in Safari 5 and Chrome 5).
Web Workers are fantastically simple. Simple message passing. No thread locks and semaphores and craziness. However, not being able to share a thing as a constraint is painful, and a nice addition to the spec is the notion of a SharedWorker:
Instead of a single message processing function, workers can attach multiple event listeners, each one performing a quick check to see if it is relevant for the message. If multiple authors wanted to collaborate using a single port to communicate with a worker, it would allow for independent code instead of changes having to all be made to a single event handling function.
To get the Gist of it, Rick put together some GitHub goodness to exemplify the new world:
Basic HTML page for running the test:
The HTML page called in the iframe:
The Renderer (that’s your browser window)
This demonstrates how we can connect two different pages to the same SharedWorker process, and track our connections to them from one persistent object variable. Very exciting!
Posted by Dion Almaer at 6:10 am