Skip to content

threadizer/core

Repository files navigation

npm

Image

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