package bonsai

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

Install

Dune Dependency

Authors

Maintainers

Sources

v0.15.1.tar.gz
sha256=0c4a714146073f421f1a6179561f836b45d8dc012c743207d3481ea63bef74bf

doc/src/bonsai/var.ml.html

Source file var.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
open! Core
open! Import

type 'a t = 'a Incr.Var.t

let create x = Incr.Var.create x

let set t v =
  if Incr.am_stabilizing ()
  then failwith "Bonsai.Var mutated during the computation of a Bonsai value";
  Incr.Var.set t v
;;

let update t ~f =
  let old = Incr.Var.value t in
  set t (f old)
;;

let get t = Incr.Var.value t
let value t = t |> Incr.Var.watch |> Value.of_incr
OCaml

Innovation. Community. Security.