Module Bonsai_private_base.Snapshot

A snapshot represents the state of a component at an instant in time.

type ('model, 'input, 'result) t
val input : (_, 'input, _) t -> 'input Input.t

The input in a snapshot contains any incrementally computed data required by the computation's apply-action function.

val result : (_, _, 'result) t -> 'result Ui_incr.t

The result of a component is the primary value computed by the component in question. At the top level of a UI, this is generally a representation of the view, but it's often useful to compute other kinds of results in inner components.

val lifecycle : (_, _, _) t -> Lifecycle.Collection.t Ui_incr.t option

The lifecycle component of a snapshot contains an optional map of all the activation, deactivation, and after_display callbacks.

val lifecycle_or_empty : here:Core.Source_code_position.t -> (_, _, _) t -> Lifecycle.Collection.t Ui_incr.t
val create : here:Core.Source_code_position.t -> input:'input Input.t -> lifecycle:Lifecycle.Collection.t Ui_incr.t option -> result:'result Ui_incr.t -> ('model, 'input, 'result) t

Creates a new snapshot. Note that the apply_action provided here should apply the action in question to the model in force at the time create is called.

val attribute_positions : Core.Source_code_position.t -> (_, _, _) t -> unit