yTakkar / fun-with-workers

Some projects exploring different ways to create web-workers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Some projects exploring different ways to create web-workers

License:MIT License


Languages

Language:JavaScript 72.6%Language:HTML 27.4%