Great that worked well.

Is there a way to do equivalent of emscripten_force_exit or 
emscripten_cancel_main_loop from javascript side? For example, we'd like to 
have a browser version test and stop further execution if we know the 
browser won't be supported.

Thanks!

On Tuesday, May 10, 2016 at 1:01:35 PM UTC-4, Alon Zakai wrote:
>
> The code after the simulated infinite loop can't execute. Instead, you can 
> put it in a method and call it after calling cancel_main_loop.
>
> Errors should cancel the main loop, as well as all other async callbacks - 
> we set the global JS var ABORT when everything should exit. exit() will do 
> the same, unless noExitRuntime is set, which async callbacks like the main 
> loop invoke. Instead of normal exit(), you can call emscripten_force_exit() 
> which make sure no more code runs after it.
>
> On Tue, May 10, 2016 at 8:12 AM, Robert Goulet <[email protected] 
> <javascript:>> wrote:
>
>> Hi all,
>>
>> what is the proper way to handle application exit? For instance, what's 
>> the proper code when your main is setup as such (simulated infinite loop) :
>>
>> void update(void* args)
>> {
>>     App* app = (App*)args;
>>     app->update();
>> }
>>
>> int main()
>> {
>>     init_systems();
>>     auto app = new App;
>>     emscripten_set_main_loop_arg(&update, app, 0, true);
>>     delete app;
>>     free_systems();
>> }
>>
>> How do we exit the emscripten main loop and continue executing whatever 
>> code that exist beyond the main loop?
>>
>> On a similar topic, upon assertions/errors in code, how do we completely 
>> stop the application/javascript with a behavior similar to C exit(code) 
>> function? When we call exit(code), it seems main loop is still running?
>>
>> What's the general guideline for application life cycle?
>>
>> Thanks!
>>
>> -- 
>> 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] <javascript:>.
>> 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