rustwasm / wasm-bindgen

Facilitating high-level interactions between Wasm modules and JavaScript
https://rustwasm.github.io/docs/wasm-bindgen/
Apache License 2.0
7.84k stars 1.08k forks source link

Can todomvc handle asynchronous events? #1711

Open UnHumbleBen opened 5 years ago

UnHumbleBen commented 5 years ago

Summary

Can TODO MVC handle asynchronous events?

The documentation claims that

A Scheduler that allows Controller and View to communicate to each other by emulating something similar to the JS event loop.

Does it also emulate the ability to handle asynchronous events?

Additional Details

I will provide a high level overview of this file

As you can see, there is a recursive pattern between run and next_message because the functions call each other back and forth until the entire call stack is cleared. While they are executing, can events happen in between? Let's say the user clicks something, this should call add_message. Can add_message executes while run and next_message call each other?

If Yes, how would that work because I do not see any signs of multi-threaded rust code.

If No, wouldn't this lead to an unresponsive web app because the entire call stack would need to be cleared before the user can do anything.

alexcrichton commented 5 years ago

cc @jonathanKingston, would you be able to help out here?