/sweet-web-workers

Dead simple example on how to use web workers with react with and without comlink ⚙️

Primary LanguageTypeScript

Dead simple web workers ⚙️

This repo is bunch of dead simple examples on how to use web workers with react.

Screen Shot 2021-10-13 at 18 01 55

What's inside

There are two implementations vanilla and comlink. First one is vanilla JS approach while the latter one shows how to use it with TS in a more promise-like way.

1- Vanilla Web Worker 🚲

Use vanilla-step1 to practice, and vanilla-step2 to inspect implementation

Where is worker

👀 -> public/long-runner.js

2- Comlink and TS 🚗

Use comlink-step1 to practice, and comlink-step2 to inspect implementation

Where is worker

👀 -> src/workers/long-runner/long-runner.ts

How to start

yarn & yarn start

Useful links