Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

function-worker

hepingxm18MIT1.0.3

It does not need to pass in external JS files, but directly executes the worker of local JS functions

worker, local-worker, local worker

readme

function-worker

中文文档

usage

We usually create workers in this way

const myWorker = new Worker(aURL, options);

There is a big drawback to this approach,You have to create a JS before you reference it

If we want to run a function in worker,it will be better

const localWorker = require('function-worker')
const worker = localWorker(function () {
    // Code you want to run in worker
})


// or the same effect
const worker = localWorker.getWorker(function () {
    // Code you want to run in worker
})