The Wraker class provides an interface for interacting with a web worker.
It allows sending requests to the worker and handling responses asynchronously.
Example
// Create a new Wraker instance with a worker script URL constinstance = newWraker(newURL("worker.js", import.meta.url), { type:"module", });
Example
// Initialize a Wraker instance from an existing Worker constworker = newWorker("worker.js"); constinstance = Wraker.fromWorker(worker);
Example
// Fetch data from the worker constdata = awaitinstance.fetch("/hello"); console.log(data.body); // Hello, world!
The
Wraker
class provides an interface for interacting with a web worker. It allows sending requests to the worker and handling responses asynchronously.Example
Example
Example