@threadizer/core
v1.0.0
Published
Execute code within workers made simple
Downloads
65
Maintainers
Readme
Threadizer
Run code within a worker (or main-thread as fallback).
The package is published on npm, sources and documentation are available on github.
Quick start
import Threadizer from "@threadizer/core";
// ...
const thread = new Threadizer(( thread )=>{
console.log("Worker initialized", thread);
thread.on("any-event", ({ detail: data, complete })=>{
console.log("Processing data", data);
//...
complete(data);
});
});
const results = await thread.transfer("any-event", someData);
More examples are available on the demo page and the full documentation is in the wiki