package bonsai

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

A Var.t is the primary method for making data obtained outside of Bonsai (maybe via an RPC) accessible inside a Bonsai application.

val create : 'a -> 'a t

Creates a new Var.t with an initial value.

val update : 'a t -> f:('a -> 'a) -> unit

Updates the value inside of t. f is given the previous value of t so that you can reuse parts of the value if applicable

val set : 'a t -> 'a -> unit

Sets the value inside of t.

val get : 'a t -> 'a

Gets the value inside of t.

val value : 'a t -> 'a Value.t

Provides read-only access to t by producing a Value.t which is used inside of a Bonsai computation.