module Snabbdom_base:sig..end
exception Not_supported
typepatchfn =Snabbdom_vnode.t -> Snabbdom_vnode.t -> unit
type snabbdom_module
See the Snabbdom documentation for details on modules
If you've built a custom module, you can define it using:
external my_module : snabbdom_module = "default" [@@bs.module "path/to/module"]val init : snabbdom_module array -> patchfnval h : string -> Snabbdom_vnode.transformer list -> Snabbdom_vnode.tSince we're working in a different language, bs-snabbdom provides a slightly different h function for constructing the vnodes that better works with OCaml.
The first parameter is the same as Snabbdom's - an html selector describing the element type and any classes/id to apply to the element.
The second parameter takes a list of Snabbdom_vnode.transformer functions, which
specify how to create the vnode. Some transformers are implemented in this
module below.
Usage example:
h "div.section" [
style "border" "1px solid black";
text "Hello World!"
]val children : Snabbdom_vnode.t list -> Snabbdom_vnode.transformerval text : string -> Snabbdom_vnode.transformerval key : string -> Snabbdom_vnode.transformerval nothing : Snabbdom_vnode.transformerSnabbdom_vnode.t. Can be useful for if statements:
if is_active then class_name "is-active" else nothingval module_attributes : snabbdom_module
val attr : string -> string -> Snabbdom_vnode.transformer
val module_class : snabbdom_module
val class_name : string -> Snabbdom_vnode.transformer
val module_style : snabbdom_module
val style : string -> string -> Snabbdom_vnode.transformer
val style_delayed : string -> string -> Snabbdom_vnode.transformer
val style_remove : string -> string -> Snabbdom_vnode.transformer