1.0.3 • Published 4 years ago

function-worker v1.0.3

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

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
})