In default form, this is not possible. The message loop must periodically
yield back to the browser. There are however some ways around this, but all
of those have some other limitations, so there is unfortunately no perfect
solution yet:
 - Use the --proxy-to-worker option to build the whole code to run in a
worker, in which case it can synchronously block. However its interaction
with the Web APIs is then limited.
 - Use the Emscripten asyncify feature to have the compiler automatically
attempt to asynchronify the code. See
https://github.com/kripken/emscripten/wiki/Asyncify
 - Use the Emscripten Emterpreter feature to interpret the code instead of
running it directly. See
https://github.com/kripken/emscripten/wiki/Emterpreter

For best results however, I would recommend making your message loop
asynchronous for now. We are actively investigating ways to remove this
limitation, but unfortunately are not there yet :\

2015-06-03 14:19 GMT+03:00 awt <[email protected]>:

> Hi,
>
> Is the following possible in Emscripten?
>
> 1. Start a message loop and poll for a keyboard event. E.g. using
> SDL_PollEvent
> 2. Do not proceed until the event is entered by the user.
> 3. Return from the message loop when the user enters his selection.
> 4. Execute the code right after the message loop in the same function.
>
> I understand that we cannot use a while loop because that will block the
> browser from all receiving the keyboard inputs in the first place. Are
> there other techniques available that can solve this issue? Thanks in
> advance.
>
> --
> 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