package bonsai

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

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

type ('model, 'action, 'result) t
val apply_action : ('model, 'action, _) t -> ('model, 'action) Bonsai__.Apply_action.t

Applies the provided action to the model in force at the time that the snapshot was created.

The application of the action is allowed to engage in side-effecting computations, including calling the schedule_event function to request that further actions be enqueued to be applied to the model.

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 -> (Bonsai__.Path.t, Bonsai__.Lifecycle.t, Bonsai__.Path.comparator_witness) Core__Map_intf.Map.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 : (_, _, _) t -> (Bonsai__.Path.t, Bonsai__.Lifecycle.t, Bonsai__.Path.comparator_witness) Core__Map_intf.Map.t Ui_incr.t
val create : apply_action:('model, 'action) Bonsai__.Apply_action.t -> lifecycle: (Bonsai__.Path.t, Bonsai__.Lifecycle.t, Bonsai__.Path.comparator_witness) Core__Map_intf.Map.t Ui_incr.t option -> result:'result Ui_incr.t -> ('model, 'action, '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 option -> (_, _, _) t -> unit
OCaml

Innovation. Community. Security.