package js_of_ocaml

  1. Overview
  2. Docs
Compiler from OCaml bytecode to JavaScript

Install

dune-project
 Dependency

Authors

Maintainers

Sources

js_of_ocaml-6.5.0.tbz
sha256=a991ce25175a5a13240c8bf64354b8f35e0a8d7223b90bef01ba32bc6f929cf4
sha512=ce476986cb2c78990f29b1d7a01bb173a0d30ad0e0a80ba7bde9aa8365952ed01eda4935d92a323b982b0c1c897b20ef01eabe75fe80e4da858f73f6a2d25232

doc/js_of_ocaml/Js_of_ocaml/MutationObserver/index.html

Module Js_of_ocaml.MutationObserverSource

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 =
      Console.console##debug records ;
      Console.console##debug observer
    in
    ignore
      (MutationObserver.observe ~node ~f
         ~attributes:true ~child_list:true ~character_data:true
         ())
Sourceclass type mutationObserverInit = object ... end
Sourceclass type mutationRecord = object ... end
Sourceclass type mutationObserver = object ... end
Sourceval empty_mutation_observer_init : unit -> mutationObserverInit Js.t
Sourceval is_supported : unit -> bool
Sourceval 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