An extension of the basic API that supports the use of a derived model. The purpose of this is to allow sharing of an incremental computation between the creation of the view and the application of an action.
module Model : sig ... end
module Derived_model : sig ... end
Derived_model
is the data container that allows you to share computations between
the actions and the view. Any things that the actions need to use should be stored
in Derived_model.t. Then, in Action.apply
, you can call
stabilize_and_get_derived
to retrieve that data and make use of it.
module Model_summary : sig ... end
module State : sig ... end
module Action : sig ... end
val update_visibility : Model.t ‑> Derived_model.t ‑> recompute_derived:(Model.t ‑> Derived_model.t) ‑> Model.t
update_visbility
gives you access to both the model and the derived model.
If you do some intermediate updates to the model, and would like to recompute the
derived model from those, recompute_derived model' => derived'
will give you
that ability. recompute_derived
updates the model in the incremental graph and
re-stabilizes the derived model, before giving it back to you.
val view : Model.t Incr.t ‑> Derived_model.t Incr.t ‑> inject:(Action.t ‑> Virtual_dom.Vdom.Event.t) ‑> Virtual_dom.Vdom.Node.t Incr.t
val on_startup : schedule:(Action.t ‑> unit) ‑> Model.t ‑> Derived_model.t ‑> State.t Async_kernel.Deferred.t
val on_display : old:Model_summary.t ‑> Model.t ‑> Derived_model.t ‑> State.t ‑> unit