package vdom

  1. Overview
  2. Docs

Module Vdom_blit.CustomSource

Sourcetype t

A controller for a custom element.

Sourcetype event =
  1. | Custom of Vdom.Custom.event
  2. | Encoded of {
    1. event_type : string;
    2. encoder : Encoder.t;
    }
Sourceval blur_event : event
Sourceval input_event : string -> event
Sourceval checked_event : bool -> event
Sourceval change_event : string -> event
Sourceval change_index_event : int -> event
Sourceval custom_event : Vdom.Custom.event -> event
Sourceval 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.

Sourcetype ctx

Context for custom element handlers.

Sourceval send_event : ctx -> event -> unit

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

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

Record an action to be executed after the next redraw.

Sourcetype 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.

OCaml

Innovation. Community. Security.