()
| 31 | |
| 32 | //Make sure worker is alive? |
| 33 | async function wait_for_worker() { |
| 34 | let p1 = await new Promise((resolve) => { |
| 35 | const channel = new MessageChannel(); |
| 36 | channel.port1.onmessage = () => { |
| 37 | channel.port1.close(); |
| 38 | resolve(1); |
| 39 | } |
| 40 | worker.postMessage(0, [channel.port2]); |
| 41 | }); |
| 42 | return p1; |
| 43 | } |
| 44 | |
| 45 | function find_worker() { |
| 46 |