Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Dedicated web workers are directly associated with their respective spawning script, but shared web workers allow any number of browser window contexts to communicate with a single worker simultaneously. As you will see in this hack, shared workers implement a slightly different API, but overall the concepts are very much the same.
Just like dedicated workers, to create a shared web worker you pass
a JavaScript filename to your Worker
instance, except this time you use the SharedWorker object.
Unlike dedicated web workers, shared workers introduce the concept
of a port object that must be
designated along with the attached message event handler. After that, we
call the port’s start() method.