Thanks for your reply! But if I clear `noExitRuntime`, then exiting `main()` will shut down the runtime as well?
I tried at init: - set`noExitRuntime=0` and `noInitialRun=1` - move the body of my `main()` into an init function and let `main()` have an empty body - invoke my init function at end of `postRun` Then the main-loop runs in javascript. And then when shutting down: - run `callMain()` This appears to work as I want, application seems to get events and rendering works, and event handlers seem to be cleaned up when shutting down. Thanks, Christopher mandag 22. mars 2021 kl. 21:42:08 UTC+1 skrev [email protected]: > You should be able to set `noExitRuntime = 0` and then call `exit(0)` (or > `Module.exit(0)`). > > cheers, > sam > > On Mon, Mar 22, 2021 at 10:47 AM Christopher Dyken <[email protected]> > wrote: > >> Hi, >> >> I use emscripten for a project where I set noExitRuntime=1 since I want >> to manage the main loop myself in javascript-land. And that works well. >> >> However, I also need to shut down and clean up the module, but I haven't >> managed to find a way to invoke the shutdown code? >> >> I'm considering trying to do the init code in a dedicated function using >> noInitialRun=1 and call main() for shutdown. But maybe I am missing >> something? >> >> Thanks, >> >> Christopher >> >> -- >> 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]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/emscripten-discuss/a3a32735-9904-4a21-bf0b-fa118c3569a3n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/emscripten-discuss/a3a32735-9904-4a21-bf0b-fa118c3569a3n%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/e914580c-1a68-487f-b1bf-b6e8b07d2a4en%40googlegroups.com.
