API reference
The Js_of_ocaml distribution ships several opam packages, each providing one or more libraries. This page lists the public modules of every package; see the documentation home for the manual.
The top-level module of each library also states, in its own documentation, which opam package provides it.
js_of_ocaml — the base library
Provided by the js_of_ocaml opam package (library js_of_ocaml).
Core runtime and JavaScript values:
Js_of_ocaml.JsJavascript bindingJs_of_ocaml.Js_errorJs_of_ocaml.JstableA minimal table implementation specialized forJs.js_stringkeys. This is faster than regular OCaml hashtables.Js_of_ocaml.Sys_jsJavascript specific Sys functions.Js_of_ocaml.Typed_arrayTyped Array bindingJs_of_ocaml.Effect_jsJavascript-specific effect functions.
Browser APIs:
Js_of_ocaml.AbortAbortController / AbortSignal.Js_of_ocaml.CSSThis module contains a few types and values to ease the use of CSS properties and such. If you think a feature is missing, consider sending a patch or an RFE to the mailing list.Js_of_ocaml.ConsoleConsole API (debugging console).Js_of_ocaml.DomDOM bindingJs_of_ocaml.Dom_eventsJavascript eventsJs_of_ocaml.Dom_htmlDOM HTML bindingJs_of_ocaml.Dom_svgDOM SVG bindingJs_of_ocaml.EventSourceEventSource bindingJs_of_ocaml.FetchFetch API.Js_of_ocaml.FileFile APIJs_of_ocaml.FormJs_of_ocaml.GeolocationGeolocation APIJs_of_ocaml.IntersectionObserverThe Intersection Observer API provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport.Js_of_ocaml.IntlInternationalization APIJs_of_ocaml.JsonUnsafe IO. (SeeDeriving_Jsonfor typesafe IO)Js_of_ocaml.MutationObserverMutationObserver APIJs_of_ocaml.PerformancePerformance APIJs_of_ocaml.PerformanceObserverPerformanceObserver APIJs_of_ocaml.PromiseBindings to the JavaScriptPromiseAPI.Js_of_ocaml.RegexpTypes for regexps.Js_of_ocaml.ResizeObserverResizeObserver APIJs_of_ocaml.UrlThis module provides functions for tampering with Url. It's main goal is to allow one to stay in the Ocaml realm without wandering into theDom_html.window##.location object.Js_of_ocaml.WebGLWebGL bindingJs_of_ocaml.WebSocketsWebSocket bindingJs_of_ocaml.WorkerLow-level bindgins to javascript Web Workers.Js_of_ocaml.XmlHttpRequestXmlHttpRequest object.
The same opam package also provides the js_of_ocaml.deriving library — the runtime used by the code that [@@deriving json] generates:
Deriving_JsonTypesafe IO (based on the deriving library).Deriving_Json_lexer
js_of_ocaml-lwt — Lwt support
Provided by the js_of_ocaml-lwt opam package (library js_of_ocaml-lwt).
Js_of_ocaml_lwt.Lwt_js— sleeping and yieldingJs_of_ocaml_lwt.Lwt_js_events— DOM events as Lwt threadsJs_of_ocaml_lwt.XmlHttpRequest— XMLHttpRequest with LwtJs_of_ocaml_lwt.Jsonp— JSONP requestsJs_of_ocaml_lwt.File— reading files with LwtJs_of_ocaml_lwt.Promise— bridge between Lwt threads and JS promises
js_of_ocaml-ppx_deriving_json — JSON derivation syntax
Provided by the js_of_ocaml-ppx_deriving_json opam package. This is the PPX that derives JSON serializers ([@@deriving json]); the generated code relies on the Deriving_Json runtime from the js_of_ocaml package above. See the manual for usage.
js_of_ocaml-tyxml — TyXML support
Provided by the js_of_ocaml-tyxml opam package (library js_of_ocaml-tyxml).
Js_of_ocaml_tyxml.Tyxml_js— build and manipulate DOM trees with TyXMLJs_of_ocaml_tyxml.Tyxml_cast— cast between TyXML and Dom nodesJs_of_ocaml_tyxml.Tyxml_cast_sigs— signatures for the casts
js_of_ocaml-toplevel — toplevel and Dynlink
Provided by the js_of_ocaml-toplevel opam package (library js_of_ocaml-toplevel).
Js_of_ocaml_toplevel.JsooTop— run an OCaml toplevel in the browser