make set transport async for the user

This commit is contained in:
Toshit Chawda 2024-07-07 14:21:04 -07:00
parent 7a1273e967
commit 8ed59e901d
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
2 changed files with 3 additions and 3 deletions

View file

@ -8,7 +8,7 @@ function handleConnection(port: MessagePort) {
const port = event.data.port;
const message: WorkerMessage = event.data.message;
if (message.type === "set") {
const func = new Function(message.client);
const func = new Function("return (async ()=>{" + message.client + "})()");
currentTransport = await func();
console.log("set transport to ", currentTransport);
port.postMessage(<WorkerResponse>{ type: "set" });