Fun with workers
This repo contains 4 directories to showcase different ways to work with a Web-Worker in JavaScript.
About each directory
Native-Worker
This directory showcases the native approach of using a worker.
Worker-Loader
Showcases how a script file can be used as a worker. Uses this webpack plugin.
Workerize
Uses awesome module by Jason Miller and that is Workerize. Allows us to move a module into web-worker. Basically you'll be writing you web-worker in a function that accepts a tagged template literal.
Workerize-Loader
Uses workerize-loader webpack-plugin. Best choice in my opinion.
Running examples of above directories
-
First
clone
the repo. -
Then
cd
into any of them. For eg.cd workerize-loader
-
Install required dependencies.
yarn
-
Start the development server.
yarn start
-
Visit :4001