package brr

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Web workers.

See the Web Workers API.

Enumerations

module Type : sig ... end

The worker type enum.

Workers

type opts

The type for worker options.

val opts : ?type':Type.t -> ?credentials:Brr_io.Fetch.Request.Credentials.t -> ?name:Jstr.t -> unit -> opts

opts ~type' ~credentials ~name () are worker options with given parameters. See here for defaults and semantics.

type t

The type for Worker objects.

val create : ?opts:opts -> Jstr.t -> t

create ~opts uri creates a worker that executes the script uri. This may throw a Jv.Error exception.

val as_target : t -> Brr.Ev.target

as_target w is w as an event target.

val terminate : t -> unit

terminate w terminates worker w.

val post : ?opts:Brr_io.Message.opts -> t -> 'a -> unit

post ~opts w v posts value v on port p with options opts (the target_origin option is meaningless in this case).

Shared workers

module Shared : sig ... end

Shared workers.

Worker context

These APIs are used by the workers.

val ami : unit -> bool

ami () is true if we are executing in a worker context.

module G : sig ... end

Worker global functions