package bonsai

  1. Overview
  2. Docs

The underlying representations of Bonsai components. This module is provided "as is", without warranty of any kind, express or implied...

type ('model, 'action, 'result) t
val apply_action : ('model, 'action, _) t -> schedule_event:(Event.t -> unit) -> 'action -> 'model

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_action function to request that further actions be enqueued to be applied to the model.

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

The result of a component is the primary value computed by the component in question. At the toplevel 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 create : apply_action:(schedule_event:(Event.t -> unit) -> 'action -> 'model) -> result:'result -> ('model, 'action, 'result) t

Creates a new snapshot. Note that the apply_action provided here should apply the action in question to the model as it exists at the time the snapshot is created for.

OCaml

Innovation. Community. Security.