Chapter 9. Web Workers Unite

"If you want creative workers, give them enough time to play."

—John Cleese

In this chapter we will learn how to use HTML5 web workers to run background processes in another thread. We can use this to make applications with long running processes more responsive. We will draw a Mandelbrot fractal on a canvas using a web worker to generate it asynchronously without locking up the browser window.

We will learn the following topics in this chapter:

  • How to make web applications more responsive by using web workers
  • How to start and manage a web worker
  • How to communicate with a web worker and send data back and forth
  • How to draw a Mandelbrot fractal on a canvas using a web worker
  • Tips for debugging web workers

Web workers

Web ...

Get HTML5 Web Application Development By Example Beginner's guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.