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.4.1.tbz
sha256=e59bbffcaefaba3191620556514b7f53bb3249e3f881a070d72724234dffd819
sha512=bb470f316f9c81a3b2b8dedd0b0f18f8e06beb48dd70df1d9f846de90ffab439cab5ef7a93a8166af0998068b06097e8319bc0d9f4f23a7159b0de8b3b515746

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