Brr is a toolkit for programming browsers in OCaml with the js_of_ocaml
compiler. It provides:
These manuals are available:
js_of_ocaml
and Brr. Recommended reading.Also the test directory of Brr's repository has a few examples that use the APIs.
brr
This library has the JavaScript FFI and the interfaces to the supported browser APIs.
Jstr
JavaScript stringsJv
JavaScript values.Fut
Future values.Brr
Browser APIs.Brr_canvas
Canvas APIs.Brr_io
Clipboard, Form, Fetch, Geolocation, Media and Storage APIs.Brr_webaudio
Web Audio API.Brr_webcrypto
Web Crypto API.Brr_webgpu
WebGPU API.Brr_webmidi
Web MIDI API.Brr_webworkers
Web and Service Worker APIs.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.
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.
Brr_ocaml_poke
ocaml_poke
object for OCaml console.Brr_ocaml_poke_ui
Interactive toplevel HTML interface for poke objects.The following JavaScript and browser functionality is supported:
Jv
.String
s are in Jstr
.Jstr.pad_start
.Promise
s are in Fut
to safely type them. Brr.Abort
has support for aborting them.ArrayBuffer
s and TypedArray
s are in Brr.Tarray
.Brr.Base64
, Brr.Json
.Brr.G
.Brr.Ev
, Brr.At
and Brr.El
.Brr.Console
, Brr.Window
, Brr.Navigator
.Brr.Blob
Brr_io.Message
.Brr_canvas.C2d
.Brr_io.Fetch.Cache
.Brr_io.Clipboard
.Brr.File
.Brr_io.Fetch
.Brr_io.Form
.Brr_io.Geolocation
.Brr.Window.History
.Brr_io.Media
.Brr_io.Notification
.Brr.Performance
.Brr_webworkers.Service_worker
.Brr.Uri
.Brr_webaudio
.Brr_webcrypto
.Brr_canvas.Gl
.Brr_webgpu.Gpu
.Brr_webmidi
.Brr_io.Websocket
.Brr_io.Storage
.Brr_webworkers.Worker
.Finally note that: