JSFiddle - React, Tailwind, and code Playground

by Jason Miller

HTML

<script src="https://unpkg.com/workerize@0.1.7/dist/workerize.umd.js"></script>

JavaScript

const worker = workerize(function(exports) {
  /*
  export function a(){}
  export function b(){}
  */
  exports.a = () => 1;
  exports.b = () => 2;
});

worker.a().then(console.log)  // 1
worker.b().then(console.log)  // 2