@monorail generally when i do games stuff in JS i have:
- event listeners, which write to a object which tracks input states
- logic loop, which reads input states and read/writes game state
- rendering loop, which reads (but does not write!!) game state and updates the page