plinth/browser/service_worker

Types

pub type ActivateEvent
pub type FetchEvent
pub type GlobalScope
pub type Registration
pub type Request
pub type Response
pub type ServiceWorker

Values

pub fn active(
  registration: Registration,
) -> Result(ServiceWorker, Nil)
pub fn add_activate_listener(
  self: GlobalScope,
  listener: fn(ActivateEvent) -> Nil,
) -> Nil
pub fn add_fetch_listener(
  self: GlobalScope,
  listener: fn(FetchEvent) -> Nil,
) -> Nil
pub fn async_respond_with(
  event: FetchEvent,
  response: promise.Promise(Response),
) -> Result(Nil, String)
pub fn client_get(
  self: GlobalScope,
  id: String,
) -> promise.Promise(Result(message.Client, Nil))
pub fn client_id(event: FetchEvent) -> String
pub fn client_post_message(
  worker: message.Client,
  message: json.Json,
) -> Nil
pub fn do_claim(self: GlobalScope) -> promise.Promise(Nil)
pub fn fetch_event_client(event: FetchEvent) -> message.Client
pub fn frame_type(client: message.Client) -> String
pub fn installing(
  registration: Registration,
) -> Result(ServiceWorker, Nil)
pub fn open_window(
  self: GlobalScope,
  url: String,
) -> promise.Promise(Result(Int, Nil))
pub fn origin(self: GlobalScope) -> String
pub fn register(
  script_url: String,
) -> promise.Promise(Result(Registration, String))
pub fn request(event: FetchEvent) -> Request
pub fn respond_with(
  event: FetchEvent,
  response: Response,
) -> Result(Nil, String)
pub fn resulting_client_id(event: FetchEvent) -> String
pub fn script_url(self: GlobalScope) -> String

Deprecated: self.serviceWorker not available in firefox.

self.serviceWorker not available in firefox https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/serviceWorker

pub fn self() -> Result(GlobalScope, String)
pub fn self_on_message(
  worker: GlobalScope,
  handle: fn(message.Message) -> Nil,
) -> Nil
pub fn service_worker_on_message(
  handle: fn(json.Json) -> Nil,
) -> Nil
pub fn service_worker_post_message(
  worker: ServiceWorker,
  message: json.Json,
) -> Nil
pub fn skip_waiting(self: GlobalScope) -> promise.Promise(Nil)
pub fn waiting(
  registration: Registration,
) -> Result(ServiceWorker, Nil)
Search Document