package bonsai
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
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.test_of_bonsai_itself/test_handle_compute_lazy.ml.html
Source file test_handle_compute_lazy.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 41 42 43 44 45 46 47 48 49 50 51 52 53open! Core open! Import open Bonsai_test open Bonsai.For_open let handle () = let var = Bonsai.Var.create 0 in let handle = Handle.create (module struct type t = int type incoming = unit let view i = print_endline "computing the view!"; Int.to_string i ;; let incoming _i () = Effect.Ignore end) (Bonsai.read (Bonsai.Var.value var)) in handle, var ;; let%expect_test "Handle.show forces the view" = let handle, var = handle () in Handle.show handle; [%expect {| computing the view! 0 |}]; Bonsai.Var.set var 1; Handle.show handle; [%expect {| computing the view! 1 |}] ;; let%expect_test "Handle.recompute_view should _not_ force the view" = let handle, var = handle () in Handle.recompute_view handle; [%expect {| |}]; Bonsai.Var.set var 1; Handle.recompute_view handle; [%expect {| |}]; Handle.show handle; [%expect {| computing the view! 1 |}] ;;
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>