A tight (display ...) loop used to fire one postMessage per display call — main thread couldn't even register click events because the message queue grew faster than it could drain. Fox saw this as "the tab just keeps looping when I leave it" — the tab-switch click never reached setActiveTab so autoPauseTab never fired, and the worker kept running until it finished on its own. Now the worker accumulates chunks into a local string buffer and postMessages a single chunk-batch message when the buffer hits 64KB or 4096 newlines. The 'done'/'error' path drains whatever's left before signalling so the last lines still reach the UI. Main thread handlers (repl + playground) split the batch back into the same text+eol sequence the live streaming row expects. Adds RAF coalescing on the receive side too: attachStreaming now batches DOM textContent / appendChild updates into one requestAnimationFrame tick so the 60 Hz repaint budget is shared across all chunks that landed in that window. finalize() drains the RAF buffer synchronously before the streamed-vs-expected match check so error-on-cancel keeps the most recent lines. |
||
|---|---|---|
| .. | ||
| app | ||
| asm | ||
| c | ||
| dist-repl | ||
| python | ||
| repl | ||
| tests | ||
| Makefile | ||
| serve-coop.py | ||