Rust / wasm32 / low latency / games / JS wrapper?

For those working on Games / Low-Latency on Rust/wasm32, is there a noticeable difference between:

  1. Rust register onkeydown/mouse handler , getting keyboard/mouse events directly

  2. JS registers onkeydown/mouse handlers, calls Rust function to handle the input

Both cases are pretty much equivalent. Wasm can't directly call javascript functions that accept functions, so wasm-bindgen has to create a wrapper javascript function to handle registering the event handler and calling back into rust. Manually writing this wrapper could be a bit more efficient I guess.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.