package bonsai

  1. Overview
  2. Docs
module Action : sig ... end
val apply_action : inject:(Action.t -> Event.t) -> schedule_event:(Event.t -> unit) -> Input.t -> Model.t -> Action.t -> Model.t

apply_action is a transformation from a model and an action into a new model. During the transformation, the Component can also emit more actions via schedule_event or use Async to arrange for schedule_event to be called later.

val compute : inject:(Action.t -> Event.t) -> Input.t -> Model.t -> Result.t

Computes the Result.t of the component based off of the Model.t.

The inject argument is used to transform actions into Event.ts for use in event handlers like on_click.

val name : string

A name to identify this component.

A reasonable fallback is Source_code_position.to_string [%here].

OCaml

Innovation. Community. Security.