O'Reilly logo

JavaScript Concurrency by Adam Boduch

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

Using Parallel.js

The aim of the Parallel.js library is to make interacting with web workers as seamless as possible. In fact, it handles one of the key goals of this book—it hides the concurrency mechanism and allows us to focus on the application that we're building.

In this section, we'll look at the approach taken by Parallel.js for worker communication and the general approach of passing code to workers. Then, we'll walk through some code that uses Parallel.js to spawn new worker processes. Lastly, we'll explore the built-in map/reduce capabilities that the library has to offer.

How it works

All the workers that we've used so far in this book have been our own creation. We implemented message event handling in our workers that computed some ...

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