rename setTransport to setManualTransport

This commit is contained in:
Toshit Chawda 2024-07-07 15:12:34 -07:00
parent cad770e2d1
commit fb8fe1d306
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
3 changed files with 18 additions and 4 deletions

View file

@ -107,10 +107,17 @@ export class BareMuxConnection {
this.worker = new WorkerConnection(workerPath);
}
async setTransport(transport: string) {
async setTransport(path: string, options: any[]) {
await this.setManualTransport(`
const { default: BareTransport } = await import("${path}");
return new BareTransport(${options.map(x => JSON.stringify(x)).join(", ")});
`);
}
async setManualTransport(functionBody: string) {
await this.worker.sendMessage({
type: "set",
client: transport,
client: functionBody,
});
}
}