We should document this better, yeah. I'll add something to the FAQ.

Basically, the easiest way is to just add a main() function. It will be
called when all startup is done. You can make main call your JS (using
EM_ASM for example) to notify it that the library is now safe to call.

- Alon



On Wed, Aug 13, 2014 at 2:39 PM, Rodrigo Benenson <
[email protected]> wrote:

> This is certainly a beginner's question.
>
> I ported a library from C++ to javascript via emscripten.
> The script works fine, but sometimes when internet is slow the user might
> launch call to the emscripten functions before they are defined.
>
> What is the recommended way to detect when emscripten has finished loading
> ?
> In other words, how to get a programmatic notification of the usual "pre-main
> prep time: 1792 ms" message ?
> (note that this is a library, so no main function defined)
>
> Thanks for you answers.
> I could not find an answer in the documentation, I hope it was not hidden
> somewhere out there.
> Regards,
> rodrigob.
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to