npm.io
0.1.6 • Published 7 years ago

text-to-worker

Licence
MIT
Version
0.1.6
Deps
0
Size
11 kB
Vulns
0
Weekly
0
Stars
17

text-to-worker

Moves a module into a Web Worker, automatically reflecting exported functions as asynchronous proxies.

Install

npm install --save text-to-worker

worker.js:

import { textToWorker } from "text-to-worker";

let worker = textToWorker(`
	function sum(a, b) {
        return a + b;
    }
`);

(async () => {
    const result = await worker.sum(1, 2);
    console.log(result);//prints 3;
})();

License

MIT License Nishkal Kashyap

Keywords