package bonsai

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.17.0.tar.gz
sha256=c78c4476ee6b856846e2d0941e5965009d5e1b853e564b2b1bee61202f0b1ebb

doc/src/bonsai.bench/config.ml.html

Source file config.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
open! Core
open! Bonsai

type ('a, 'r) unpacked =
  { clock : Bonsai.Time_source.t
  ; name : string
  ; component : 'r Computation.t
  ; get_inject : 'r -> 'a -> unit Effect.t
  ; interaction : 'a Interaction.t
  }

type t = T : (_, _) unpacked -> t

let create
  ?(clock = Bonsai.Time_source.create ~start:Time_ns.epoch)
  ~name
  ~component
  ~get_inject
  interaction
  =
  T { clock; name; component; get_inject; interaction }
;;

let create_with_resetter
  ?(clock = Bonsai.Time_source.create ~start:Time_ns.epoch)
  ~name
  ~component
  ~get_inject
  interaction
  =
  T
    { clock
    ; name
    ; component
    ; get_inject
    ; interaction =
        [ interaction; Interaction.Reset_model; Interaction.Stabilize ]
        |> Interaction.many
    }
;;