Arcade.Web.Runtime
Types
A game's side of the shell. model is its model, msg its messages, fx its effects. Give a record model a one-constructor box: the JS backend names each specialization of these fns after its type arguments, and spells a record type out field by field, at every call site. hook_num the constants Arcade.Web.Paint draws with hook_boot (width, height, seed) to the first model and its effects hook_update one msg hook_perform run a batch of effects (storage, haptics, audio, ...); its first argument dispatches a msg, for an effect whose answer comes later (a network call) hook_tick the frame msg, at rAF's time hook_resize the view's new CSS size hook_down/move/up one pointer's (t, x, y) samples (Arcade.Web.Input); None sends nothing hook_cancel the pointer was lost hook_listen once at launch, after the canvas's pointer: wire any other event source (a DOM overlay's drags or fields). Its arguments read the current model and dispatch a msg hook_visible the page was shown (true) or hidden hook_scene the frame's DrawOps hook_overlay after painting: anything drawn outside the canvas, returning the msgs it produced (dispatched in order) hook_settle after the overlay's msgs, with the model they left: write model state back into the DOM (a text field) hook_marks after settle, on the same model: data-* attributes for <html>, set in order (Arcade.Web.Glue.mark)
What the runtime keeps between events, in the one Arcade.Web.Cell: the model and the canvas with its last size.
Functions
fn current(h : WebHooks(model, msg, fx)) : model do let s = run_get(h) s.run_model end