Note_brr.ElrReactive DOM elements.
Warning. Reactive DOM element mutators (Elr.set_at, Elr.set_children, etc.) and definers (Elr.def_at, Elr.def_children, etc.) use Note loggers to perform their action. To prevent memory leaks, these loggers, and thus their action, automatically get destroyed whenever the element is removed from the HTML DOM.
val set_children : Brr.El.t -> on:Brr.El.t list Note.event -> unitset_children e ~on sets e's children with the value of on whenever it occurs.
val def_children : Brr.El.t -> Brr.El.t list Note.signal -> unitdef_children e cs defines e's children over time with the value of signal cs. Warning. This assumes cs is the only entity interacting with the children.
val set_at : Brr.At.name -> on:Jstr.t option Note.event -> Brr.El.t -> unitset_at a ~on e sets attribute a of e with the value of e whenever it occurs. If the value is None this removes the attribute.
val def_at : Brr.At.name -> Jstr.t option Note.signal -> Brr.El.t -> unitdef_at a v e defines the attribute a of e over time with the value of v. Whenever the signal value is None, the attribute is removed. Warning. This assumes v is the only entity interacting with that attribute.
val set_prop : 'a Brr.El.Prop.t -> on:'a Note.event -> Brr.El.t -> unitset_prop p ~on e sets property p of e to the value of on whenever it occurs.
val def_prop : 'a Brr.El.Prop.t -> 'a Note.signal -> Brr.El.t -> unitdef_prop p v e defines the property p of e over time with the value of v. Warning. This assumes v is the only entity interacting with that property.
val set_class : Jstr.t -> on:bool Note.event -> Brr.El.t -> unitset_class a ~on e sets the membership of e to class e with the value of on whenever it occurs.
val def_class : Jstr.t -> bool Note.signal -> Brr.El.t -> unitrdef_class a b e defines the membership of e to class e over time with the value of b. Warning. This assumes b is the only entity interacting with that class.
val set_inline_style :
?important:bool ->
Brr.El.Style.prop ->
on:Jstr.t Note.event ->
Brr.El.t ->
unitset_style ~important p ~on e sets the inline style property p of e to the value of on whenever it occurs with priority important (defaults to false).
val def_inline_style :
?important:bool ->
Brr.El.Style.prop ->
Jstr.t Note.signal ->
Brr.El.t ->
unitdef_style p v e sets the inline style property p of e over time with the value of v. Warning. This assumes v is the only entity interacting with that property.
val set_has_focus : on:bool Note.event -> Brr.El.t -> unitset_focus e ~on sets e's focus with the value of on whenever it occurs.
val def_has_focus : bool Note.signal -> Brr.El.t -> unitdef_focus e v defines the focus of e over time with the value of v. Warning. This asumes v is the only entity interacting with e's focus.
The browser document is watched for changes via a global MutationObserver. Whenever an element is added in the HTML DOM, its on_add callbacks get called and disposed. Whenever an element is removed from the HTML DOM, on_rem callbacks get called and disposed. A element is deemed part of the HTML DOM if its root node is the browser document.
on_add f e references f until e is inserted in the HTML DOM, at which point f () is invoked.
on_rem f e references f until e is removed from the HTML DOM, at which point f () is invoked.
val call : ('a -> Brr.El.t -> unit) -> on:'a Note.event -> Brr.El.t -> unitcall f ~on e calls f on e with the value of e whenever on occurs. The underlying logger is held by e.
val hold_logr : Brr.El.t -> Note.Logr.t -> unithold_logr e l lets e hold logger l and destroy it via on_rem once e is removed from the document.
val may_hold_logr : Brr.El.t -> Note.Logr.t option -> unitmay_hold_logr e l is like hold_logr but does nothing on None.