Main-thread bridges for the browser editor, which is built as a whole-app worker. More...
Main-thread bridges for the browser editor, which is built as a whole-app worker.
In that build main() runs on a pthread (Emscripten PROXY_TO_PTHREAD) and the single #canvas is transferred to it as an OffscreenCanvas. EM_JS bodies run in the JS context of the calling thread, so a window, document, or navigator reference in an EM_JS body would evaluate in a DedicatedWorkerGlobalScope where those globals do not exist. This header owns every browser-page seam the editor uses instead.
Two mechanisms, chosen per seam by how often it is read:
Nothing here is compiled unless DONNER_EDITOR_WHOLE_APP_WORKER is defined, which the browser editor build always defines.