1. Overview
  2. Docs
type t

A controller for a custom element.

val make : ?dispose:(unit -> unit) -> sync:(Vdom.Custom.t -> bool) -> Js_browser.Element.t -> t

Create a custom controller out of DOM element.

The sync function is in charge of updating the internal state of the custom element when the VDOM changes. It must return true if the update was successful, or false if the element needs to be destroyed and recreated.

type ctx

Context for custom element handlers.

val parent : ctx -> Js_browser.Element.t
val send_event : ctx -> Vdom.event -> unit

Can only be called after the handler returns (typically in a DOM event callback).

val after_redraw : ctx -> (unit -> unit) -> unit

Record an action to be executed after the next redraw.

type handler = ctx -> Vdom.Custom.t -> t option

A custom element handler recognizes some kinds of custom elements described in the VDOM and instantiante a concrete controller for them.