-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
This FAQ says Module.onRuntimeInitialized will be called when everything is ready:
https://emscripten.org/docs/getting_started/FAQ.html?highlight=onruntimeinitialized
This works for me on Chrome, but not on Safari.
My emscripten compiled&linked x.js file has the line:
if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"]();
In Chrome, Module["onRuntimeInitialized"] returns the function I defined in the file that calls:
Module['onRuntimeInitialized'] = function () { console.log("got it!") }
import initModule from "./x.js";
initModule(Module)
But in Safari, Module["onRuntimeInitialized"] returns undefined.
I can manually edit the x.js file to call some other global function, but it would be nice if it worked as described in the FAQ.
My emcc version is:
% emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.27 (afa75f3)
clang version 16.0.0 (https://github.com/llvm/llvm-project dee009d3b5c71a340eb4ebb3cfb49f6015a789cc)
Target: wasm32-unknown-emscripten
Thread model: posix