remove broadcastchannel for workerPath, let the client pass in a messageport, use snapshot for more stuff

This commit is contained in:
Toshit Chawda 2024-07-09 10:28:36 -07:00
parent 91f27d4c06
commit cb443135d9
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
4 changed files with 32 additions and 33 deletions

View file

@ -124,6 +124,10 @@ export class BareMuxConnection {
client: functionBody,
});
}
async getInnerPort(): Promise<MessagePort> {
return await this.worker.port;
}
}
export class BareClient {
@ -132,8 +136,8 @@ export class BareClient {
/**
* Create a BareClient. Calls to fetch and connect will wait for an implementation to be ready.
*/
constructor(workerPath?: string) {
this.worker = new WorkerConnection(workerPath);
constructor(worker?: string | MessagePort) {
this.worker = new WorkerConnection(worker);
}
createWebSocket(