package bonsai

  1. Overview
  2. Docs
A library for building dynamic webapps, using Js_of_ocaml

Install

Dune Dependency

Authors

Maintainers

Sources

bonsai-v0.14.0.tar.gz
sha256=43f35d648644492d776bf2c7b86c8227e7793615b6a658432e95f8dccd3631f8
md5=b5e743dbfa64d0da5fd660f14cd0b549

doc/bonsai.types/Bonsai_types/Snapshot/index.html

Module Bonsai_types.Snapshot

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

type ('model, 'action, 'result, 'event) t
val apply_action : ('model, 'action, _, 'event) t -> schedule_event:('event -> 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_event 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 -> unit) -> 'action -> 'model) -> result:'result -> ('model, 'action, 'result, 'event) 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.