package js_of_ocaml

All checked builds pass
  1. Overview
  2. Docs
Compiler from OCaml bytecode to JavaScript

Install

dune-project
 Dependency

Authors

Maintainers

Sources

js_of_ocaml-6.5.0.tbz
sha256=a991ce25175a5a13240c8bf64354b8f35e0a8d7223b90bef01ba32bc6f929cf4
sha512=ce476986cb2c78990f29b1d7a01bb173a0d30ad0e0a80ba7bde9aa8365952ed01eda4935d92a323b982b0c1c897b20ef01eabe75fe80e4da858f73f6a2d25232

doc/js_of_ocaml/Js_of_ocaml/ServiceWorker/index.html

Module Js_of_ocaml.ServiceWorkerSource

Service Workers.

This module covers both sides of the API: the page-facing registration API (container, serviceWorkerContainer, serviceWorkerRegistration, serviceWorker) and the worker-side global scope (global, serviceWorkerGlobalScope and its events). The Cache API used inside a worker lives in Cache.

Service Workers require a secure context. The Promise-typed members use Promise.

Sourceclass type serviceWorker = object ... end

A service worker, as seen from a controlled page. Inherits EventTarget.

Sourceclass type registrationOptions = object ... end

Options for serviceWorkerContainer##register_withOptions. Create an empty record with empty_registration_options.

Sourceval empty_registration_options : unit -> registrationOptions Js.t
Sourceclass type navigationPreloadState = object ... end

The state of a registration's navigation preload, as resolved by navigationPreloadManager##getState.

Sourceclass type navigationPreloadManager = object ... end

Manages navigation preloading for a serviceWorkerRegistration, exposed as its navigationPreload.

Sourceclass type serviceWorkerRegistration = object ... end

A registration of a service worker against a scope. Inherits EventTarget.

Sourceclass type serviceWorkerContainer = object ... end

The page-facing entry point, exposed as navigator.serviceWorker (see container). Inherits EventTarget.

navigator.serviceWorker, or undefined when service workers are not supported (including non-secure contexts).

Sourceval is_supported : unit -> bool

Whether navigator.serviceWorker is available in the current environment.

Service worker global scope

The following bindings are meant to be used from inside a service worker (see global); they are not available on a controlled page.

Sourceclass type extendableEvent = object ... end

Base class of events that may extend the service worker's lifetime via waitUntil.

Sourceclass type fetchEvent = object ... end

The event passed to the worker's fetch handler.

Sourceclass type 'a extendableMessageEvent = object ... end

The event delivered to the worker's message / messageerror handlers. Unlike a plain Dom_html.messageEvent it extends extendableEvent, so the handler can call waitUntil to keep the worker alive until asynchronous processing of the message finishes. The type parameter 'a is the type of the data payload.

Sourceclass type client = object ... end

A client (a Window, worker or shared worker) controlled by the worker.

Sourceclass type windowClient = object ... end

A client that is a top-level browsing context (a window/tab).

Sourceclass type clientsQueryOptions = object ... end

Options for clients##matchAll_withOptions. Create an empty record with empty_clients_query_options.

Sourceval empty_clients_query_options : unit -> clientsQueryOptions Js.t
Sourceclass type clients = object ... end

The worker's clients object, used to enumerate and message controlled clients.

Sourceclass type serviceWorkerGlobalScope = object ... end

The global scope of a running service worker (its self). Inherits EventTarget.

The service worker's global scope. Only meaningful when the current code is actually running as a service worker.