Popularity
5.7
Stable
Activity
0.0
Stable
4,339
52
113

Programming language: JavaScript
Tags: Web Worker    

workerize alternatives and similar libraries

Based on the "Web Worker" category.
Alternatively, view workerize alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of workerize or a related project?

Add another 'Web Worker' Library

README

๐Ÿ’– Using Webpack? You want workerize-loader โžก๏ธ

Workerize npm travis

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

  • Bundles a tiny, purpose-built RPC implementation into your app
  • If exported module methods are already async, signature is unchanged
  • Supports synchronous and asynchronous worker functions
  • Works beautifully with async/await
  • Just 800 bytes of gzipped ES3

Install

npm install --save workerize

Usage

Pass either a function or a string containing code.

worker.js:

let worker = workerize(`
    export function add(a, b) {
        // block for half a second to demonstrate asynchronicity
        let start = Date.now();
        while (Date.now()-start < 500);
        return a + b;
    }
`);

(async () => {
    console.log('3 + 9 = ', await worker.add(3, 9));
    console.log('1 + 2 = ', await worker.add(1, 2));
})();

License

MIT License ยฉ Jason Miller


*Note that all licence references and agreements mentioned in the workerize README section above are relevant to that project's source code only.