O'Reilly logo

HTML5: Your visual blueprint™ for designing rich web pages and applications by Adam McDaniel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

LINK A WEB WORKER TO YOUR WEB APPLICATION

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required