Skip to content

Commit c203d45

Browse files
committed
add worker debug script
1 parent 8fa6fec commit c203d45

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/test_workers.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<pre id="output"></pre>
2+
<p id="instructions">
3+
Run <code>python -m http.server 2255</code>,
4+
then open <a href="http://localhost:2255/test/test_workers.html">this file</a>.
5+
</p>
6+
<script>
7+
for (const dbg of ["-debug", ""]) {
8+
for (const asm of ["-asm", "-wasm"]) {
9+
const url = `../dist/worker.sql${asm}${dbg}.js`;
10+
const start_time = performance.now();
11+
const worker = new Worker(url);
12+
worker.onmessage = (e) => {
13+
output.textContent += `[${url}] [${(performance.now() - start_time).toFixed(2)}ms] ${JSON.stringify(e.data)}\n\n`;
14+
instructions.style.display = "none";
15+
}
16+
worker.onerror = (e) => {
17+
output.textContent += `[error] [${url}] [${(performance.now() - start_time).toFixed(2)}ms] ${JSON.stringify(e)}\n\n`;
18+
}
19+
worker.postMessage({"action": "open", "id": 0});
20+
worker.postMessage({"action": "close", "id": 0});
21+
}
22+
}
23+
</script>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy