package prr

  1. Overview
  2. Docs

The global object, its global objects and functions.

If you are:

  • In Webworker context, see also Brr_webworkers.Worker.G
  • In an audio worklet, see also Brr_webaudio.Audio.Worklet.G

Global objects

Depending on the JavaScript environment theses values can be undefined. You should know what you are doing or use Jv.defined to test the values.

Because of type dependencies some global objects are defined in their dedicated modules:

  • Brr_io.Fetch.caches is the global caches object.
  • Brr_webcrypto.Crypto.crypto is the global crypto object.
val console : Console.t

console is the global console object (if available). This is what Console.get returns initially.

Timers

type timer_id = int

The type for timeout identifiers.

val set_timeout : ms:int -> (unit -> unit) -> timer_id

set_timeout ~ms f is a timer calling f in ms milliseconds unless stopped before.

val set_interval : ms:int -> (unit -> unit) -> timer_id

set_interval ~ms f is a timer calling f every ms milliseconds until it is stopped.

val stop_timer : timer_id -> unit

stop_timer tid stops timer tid.