mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-15 07:10:00 -04:00
make set transport async for the user
This commit is contained in:
parent
7a1273e967
commit
8ed59e901d
2 changed files with 3 additions and 3 deletions
|
@ -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" });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue