fun-with-workers

Some projects exploring different ways to create web-workers

MIT License

Stars
2
Committers
1

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

  1. First clone the repo.

  2. Then cd into any of them. For eg.

    cd workerize-loader
    
  3. Install required dependencies.

     yarn
    
  4. Start the development server.

    yarn start
    
  5. Visit :4001