Creates an RPC client that connects to a Worker or SharedWorker.
The type of the worker's API configuration.
The Worker or SharedWorker instance to connect to.
The typed RPC client.
This function establishes a connection with the worker and returns a proxy object that mirrors the worker's API.
const worker = new Worker("./worker.js");const client = createClient<MyApi>(worker);await client.someMethod(); Copy
const worker = new Worker("./worker.js");const client = createClient<MyApi>(worker);await client.someMethod();
Creates an RPC client that connects to a Worker or SharedWorker.