package js_of_ocaml

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

MutationObserver API

A code example:

if (MutationObserver.is_supported()) then
  let doc = Dom_html.document in
  let target =
    Js.Opt.get (doc##getElementById (Js.string "observed"))
      (fun () -> assert false)
  in
  let node = (target :> Dom.node Js.t) in
  let f records observer =
    Firebug.console##debug records ;
    Firebug.console##debug observer
  in
  MutationObserver.observe ~node ~f
    ~attributes:true ~child_list:true ~character_data:true
    ()
class type mutationObserverInit = object ... end
class type mutationRecord = object ... end
class type mutationObserver = object ... end
val empty_mutation_observer_init : unit -> mutationObserverInit Js.t
val is_supported : unit -> bool
val observe : node:Dom.node Js.t -> f:(mutationRecord Js.t Js.js_array Js.t -> mutationObserver Js.t -> unit) -> ?child_list:bool -> ?attributes:bool -> ?character_data:bool -> ?subtree:bool -> ?attribute_old_value:bool -> ?character_data_old_value:bool -> ?attribute_filter:Js.js_string Js.t list -> unit -> mutationObserver Js.t

Helper to create a new observer and connect it to a node

OCaml

Innovation. Community. Security.