The interface for a basic, incrementally rendered application.
module Model : sig ... endmodule Action : sig ... endmodule State : sig ... endIf you selectively render certain parts of the model based on what is visible on the
screen, use update_visibility to query the state of the DOM and make the required
updates in the model. Otherwise, it can be safely set to the identity function.
Changes in visibility that cause the page to reflow, thereby causing more changes in
visibility, must be avoided. In order to make such bugs more visible, cascading
sequences of update_visibility are not prevented.
val view : Model.t Incr.t ‑> inject:(Action.t ‑> Virtual_dom.Vdom.Event.t) ‑> Virtual_dom.Vdom.Node.t Incr.tview sets up the incremental from the model to the virtual DOM.
inject gives you the ability to create event handlers in the virtual DOM. In your
event handler, call this function on the action you would like to schedule. Virtual
DOM will automatically delegate that action back to the Start_app main loop.
val on_startup : schedule:(Action.t ‑> unit) ‑> Model.t ‑> State.t Async_kernel.Deferred.ton_startup is called once, right after the initial DOM is set to the
view that corresponds to the initial state. This is useful for doing
things like starting up async processes.