Browser programming toolkit for OCaml

Brr v0.0.3

Brr is a toolkit for programming browsers in OCaml with the js_of_ocaml compiler. It provides:


These manuals are available:

  • The Web page howto explains how to compile and integrate your OCaml program in a web page.
  • The OCaml console manual has intructions to setup the developer tool WebExtension to peek into your programs at runtime.
  • The FFI manual explains how OCaml and JavaScript values are represented by js_of_ocaml and Brr. Recommended reading.
  • The FFI cookbook has off-the-shelf design answers for common JavaScript binding scenarios.

Library brr

This library has the JavaScript FFI and the interfaces to the supported browser APIs.

Library brr.note

This library has the Note reactive infrastructure for browsers and a few higher-level APIs.

Experimental, will break in the future.

Libraries brr.poke[d] and brr.ocaml_poke[_ui]

The brr.poke library provides a function to define a poke object for your program so that the OCaml console can interact with it. Use brr.poked to poke your program by side-effect without modifying its source. In both cases you need compile your JavaScript appropriately.

  • Brr_poke OCaml poke object definition for the OCaml console.
  • Brr_poked OCaml poke by side effect.

The brr.ocaml_poke library provides support to find and access the ocaml_poke object provided by your program. The brr.ocaml_poke_ui library provides an HTML interface to the poke object as an interactive toplevel (REPL). These APIs are used by the OCaml console.

Supported browser APIs

The following JavaScript and browser functionality is supported:

Finally note that:

  • Brr is incomplete. Exhaustiveness is a non-goal.
  • Brr tracks long-term, universal and forward-looking browser changes.
  • Brr does not provide one-to-one bindings to JavaScript APIs. Some of them may be remixed, tweaked and functionality may be deliberately left out.
  • If you would like to add something, first get in touch on the issue tracker.