On Fri, Jun 13, 2025 at 2:05 AM Thomas Grund <thomas.grund.1...@gmail.com>
wrote:

> Ah ok, it is working now by changing order and putting `var Module={};` in
> front of `Module.onRuntimeInitialized=function() {...`.
>

Great!

You could also do `var Module = { onRuntimeInitialized = () => ... }` .

BTW, did you try a debug build?  Can you confirm if you saw the
assertion/warning about assigning to onRuntimeInitialized too late?

Thanks for explaining!
>
> Thomas
>
> s...@google.com schrieb am Freitag, 13. Juni 2025 um 00:48:33 UTC+2:
>
>> If you want to be sure that `onRuntimeInitialized` is called you need to
>> set it on the `Module` object before you import the generated code.
>> Otherwise the runtime could get initialized before you set
>> `Module.onRuntimeInitialized`.
>>
>> In debug builds you should see a warning when these things happen in the
>> wrong order.  See `consumedModuleProp('onRuntimeInitialized');` for how
>> this is supposed to work.
>>
>> cheers,
>> sam
>>
>> On Thu, Jun 12, 2025 at 3:11 PM Thomas Grund <thomas.g...@gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> (I want to pass large strings (around 100 MB) from JavaScript to C++ in
>>> the first place.
>>> This is a really reduced Code to show the problem, even if the code
>>> makes no sense anymore.)
>>> The Code IsNotWorking.html is working in Firefox but not in Chrome.
>>> Working means, that I can see the two console outputs:
>>>
>>> within onRuntimeInitialized
>>> within loadString
>>>
>>>
>>> The Code IsWorking.html is working in Firefox and in Chrome.
>>> The difference is just two lines which are not needed at all.
>>> Even by just commenting out these two lines, it does not work in Chrome.
>>> I put the code on Github, since there are large strings involved:
>>>
>>> https://github.com/ctgrund/Emscripten
>>>
>>> Windows 11, emcc 4.0.3, Firefox 139.0.4 64 Bit, Chrome 137.0.7151.104 64
>>> Bit
>>> Can somebody reproduce this?
>>>
>>> Thanks for Your help!!
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "emscripten-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to emscripten-disc...@googlegroups.com.
>>> To view this discussion visit
>>> https://groups.google.com/d/msgid/emscripten-discuss/fe17b884-8722-4e70-a7c5-6a1b655bb088n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/emscripten-discuss/fe17b884-8722-4e70-a7c5-6a1b655bb088n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to emscripten-discuss+unsubscr...@googlegroups.com.
> To view this discussion visit
> https://groups.google.com/d/msgid/emscripten-discuss/04e61db0-403d-4ab0-a4b3-2b070c2b0eafn%40googlegroups.com
> <https://groups.google.com/d/msgid/emscripten-discuss/04e61db0-403d-4ab0-a4b3-2b070c2b0eafn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAL_va28_tpjxp%3DPSXP2KFpkR%3DLZyNTq3gOARLcVjZ_9NBCOOmQ%40mail.gmail.com.

Reply via email to