Overview

https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers

Allow for running scripts as background threads.

Can make network requests using:

Able to send messages back and forth with JS code.

Creating an Object

Use Worker()

This runs some JS file.

Workers run in the global context. Do not use inside a window.

Cannot manipulate the DOM via a worker.

Example

const myWorker = new Worker("worker.js");