package ocaml-vdom

  1. Overview
  2. Docs

Rendering "Virtual applications" to concrete ones

module Cmd : sig ... end
module Custom : sig ... end

Extension hooks (command and custom element handlers)

type env
val cmd : Cmd.handler -> env
val custom : Custom.handler -> env
val merge : env list -> env
val empty : env
val register : env -> unit

Register global rules (command and custom element handlers). Local ones can also be passed explicitly to run.

Application controller

type ('model, 'msg) app
val run : ?env:env -> ?container:Js_browser.Element.t -> ('model, 'msg) Vdom.app -> ('model, 'msg) app

Instantion a VDOM application into a concrete one, running into a fixed fresh DOM container node.

val dispose : ('model, 'msg) app -> unit

Dispose all the resources attached to an application. If the container was provided on run, it is emptied on disposal, otherwise it is removed from the DOM.

val dom : ('model, 'msg) app -> Js_browser.Element.t

Returns the main DOM node that serves as the container for a Vdom application.

val process : ('model, 'msg) app -> 'msg -> unit

Inject a message into a VDOM application.

val get : ('model, 'msg) app -> 'model

Get the current model of the VDOM application.

val after_redraw : ('model, 'msg) app -> (unit -> unit) -> unit

Execute the callback after the next redraw