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

+23
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)