bonsai
A library for building dynamic webapps, using Js_of_ocaml
1024" x-on:close-sidebar="sidebar=window.innerWidth > 1024 && true">
package bonsai
-
bonsai
-
-
bonsai.bench
-
bonsai.example_chat_open_source_native
-
bonsai.example_chat_open_source_native_common
-
-
bonsai.extra
-
-
bonsai.focus_ring
-
bonsai.protocol
-
bonsai.tailwind_colors
-
bonsai.test
-
bonsai.test.dot
-
bonsai.web_test
-
bonsai.web_ui_common_components
-
bonsai.web_ui_drag_and_drop
-
bonsai.web_ui_element_size_hooks
-
bonsai.web_ui_file
-
bonsai.web_ui_file_from_web_file
-
bonsai.web_ui_form
-
-
bonsai.web_ui_freeform_multiselect
-
bonsai.web_ui_multi_select
-
-
bonsai.web_ui_query_box
-
bonsai.web_ui_reorderable_list
-
bonsai.web_ui_typeahead
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Library bonsai
val create :
?sexp_of:( 'a -> Core.Sexp.t ) ->
name:string ->
fallback:'a ->
unit ->
'a t
Creates a new variable for use with the rest of the functions. It is critically important that the exact same Dynamic_scope.t
is used in calls to set_within
and the corresponding lookup*
.
val derived :
?sexp_of:( 'a -> Core.Sexp.t ) ->
'b t ->
get:( 'b -> 'a ) ->
set:( 'b -> 'a -> 'b ) ->
'a t
Creates a variable which is derived from another. Typically this is used to project out a field of another dynamic variable which contains a record.
val set : 'a t -> 'a Value.t -> inside:'r Computation.t -> 'r Computation.t
Given a 'a Dynamic_scope.t
and a 'a Value.t
evaluate a function whose resulting Computation.t has access to the value via the lookup
function.
val set' :
'a t ->
'a Value.t ->
f:( revert -> 'r Computation.t ) ->
'r Computation.t
like set
but with the ability to revert the value in sub-computations.
val lookup : 'a t -> 'a Computation.t
Lookup attempts to find the value inside the nearest scope, but if there isn't one, it falls back to default specified in create
.
val modify :
'a t ->
change:( 'a Value.t -> 'a Value.t ) ->
f:( revert -> 'r Computation.t ) ->
'r Computation.t
ON THIS PAGE
No table of contents