To use a Web Worker in your website, your mainline JavaScript program, known as the parent thread, must construct the worker object from a constructor and its source code. This object can then be used to communicate to the worker by way of event messages.

The event message syntax used in the parent program is almost identical to the Web Worker code, barring a couple differences. First, the initial call to the constructor forms a worker object that facilitates communication, whereas the Web Worker within aptly uses self for communication. Second, your parent program has the capability to listen to runtime errors caused by the worker thread. Although this may not help you with debugging per se, if an issue ...

Get HTML5: Your visual blueprint™ for designing rich web pages and applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.