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
Library
Module
Module type
Parameter
Class
Class type
val on_change :
Core.Source_code_position.t ->
(module Model with type t = 'a) ->
'a Value.t ->
callback:( 'a -> unit Effect.t ) Value.t ->
unit Computation.t
When given a value and a callback, on_change
and on_change'
will watch the input variable and call the callback whenever the value changes.
callback
is also called when the component is initialized, passing in the first 'a value that gets witnessed.
val on_change' :
Core.Source_code_position.t ->
(module Model with type t = 'a) ->
'a Value.t ->
callback:( 'a option -> 'a -> unit Effect.t ) Value.t ->
unit Computation.t
The same as on_change
, but the callback function gets access to the previous value that was witnessed.
val lifecycle :
?on_activate:unit Effect.t Value.t ->
?on_deactivate:unit Effect.t Value.t ->
?after_display:unit Effect.t Value.t ->
unit ->
unit Computation.t
lifecycle
is a way to detect when a computation becomes active, inactive, or an event is triggered after every rendering (roughly 60x / second). By depending on this function (with let%sub), you can install events that are scheduled on either case.
When used, the events are scheduled in this order:
- All deactivations
- All activations
- All "after-display"s
and an "after-display" won't occur before an activation, or after a deactivation for a given computation.
val lifecycle' :
?on_activate:unit Effect.t option Value.t ->
?on_deactivate:unit Effect.t option Value.t ->
?after_display:unit Effect.t option Value.t ->
unit ->
unit Computation.t
Like lifecycle
, but the events are optional values. If the event value is None when the action occurs, nothing will happen
val after_display : unit Effect.t Value.t -> unit Computation.t
after_display
and after_display'
are lower-level functions that can be used to register an event to occur once-per-frame (after each render).
val after_display' : unit Effect.t option Value.t -> unit Computation.t
module Poll : sig ... end