Module Brr.G
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 globalcaches
object.Brr_webcrypto.Crypto.crypto
is the globalcrypto
object.
val console : Console.t
console
is the globalconsole
object (if available). This is whatConsole.get
returns initially.
val document : Document.t
document
is the globaldocument
object (if available).
navigator
is the globalnavigator
object (if available).
val performance : Performance.t
performance
is the globalperformance
object (if available).
Global event target and messaging
val target : Ev.target
target
isglobalThis
as an event target.
Global properties
val is_secure_context : bool
is_secure_context
is trueiff
the current context is secure.
Timers
val set_timeout : ms:int -> (unit -> unit) -> timer_id
set_timeout ~ms f
is a timer callingf
inms
milliseconds unless stopped before.
val set_interval : ms:int -> (unit -> unit) -> timer_id
set_interval ~ms f
is a timer callingf
everyms
milliseconds until it is stopped.
val stop_timer : timer_id -> unit
stop_timer tid
stops timertid
.
Animation timing
val request_animation_frame : (float -> unit) -> animation_frame_id
request_animation_frame f
requestf now
to be called before the next repaint. Withnow
indicating the point in time in ms when the function is called.
val cancel_animation_frame : animation_frame_id -> unit
cancel_animation_frame fid
cancels the animation frame requesta
.