Web workers with Angular 9
3 min readDec 11, 2021
WHY:
The JavaScript event loop. In Node.js many operations spawn off workers to do intensive tasks that would otherwise block the loop.
But browsers, don’t do that unless you ask them to. Sometimes the event loop thread starts feeling like this kid.
Or this guy.
If you use web workers, you can make use of the multiple cores on client devices to run blocking or long running tasks in the background.
HOW:
In your terminal, navigate to the folder of the component OR service you want to handle communication with your web worker.cd ./src/app/music
In the angular documentation it provides these two super easy cli commands to get web workers set up.