Web Workers, Shared Memory, and Atomics

In this chapter, we will cover the following recipes:

  • Performing work on separate threads with Web Workers
  • Sending messages to and from Web Workers
  • Sending data to Web Workers
  • Stopping workers with terminate
  • Creating SharedArrayBuffer
  • Sending SharedArrayBuffer to a Web Worker
  • Reading SharedArray from multiple Web Workers
  • Using Atomics to coordinate use of shared memory
  • Using promises to provide a simple interface for a worker

Get ECMAScript Cookbook 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.