@tomasperezv/worker-pool
v1.0.0
Published
Run processing tasks in background threads by using web workers.
Downloads
3
Readme
worker-pool
Run processing tasks in background threads by using web workers
const worker = new WorkerPool();
worker.run(() => {
var result = 0;
for (var i = 0; i < 100; i++) {
result += i;
}
return result;
})
.then((result) => {
console.log(result);
});
Fallback
If web-workers are not available the job will be run in the current execution context.
Build
npm run build
Test locally
npm i --dev
npm run build
npm run server
Then visit http://localhost:9999/webpack-dev-server