plinth/browser/service_worker

Types

pub type ActivateEvent
pub type FetchEvent
pub type GlobalScope
pub type Registration
pub type ServiceWorker

Functions

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(JsResponse),
) -> Result(Nil, String)
pub fn client_get(
  self: GlobalScope,
  id: String,
) -> Promise(Result(Client, Nil))
pub fn client_id(event: FetchEvent) -> String
pub fn client_post_message(worker: Client, message: Json) -> Nil
pub fn do_claim(self: GlobalScope) -> Promise(Nil)
pub fn fetch_event_client(event: FetchEvent) -> Client
pub fn frame_type(client: Client) -> String
pub fn installing(
  registration: Registration,
) -> Result(ServiceWorker, Nil)
pub fn open_window(
  self: GlobalScope,
  url: String,
) -> Promise(Result(Int, Nil))
pub fn origin(self: GlobalScope) -> String
pub fn ready() -> Promise(Registration)
pub fn register(
  script_url: String,
) -> Promise(Result(Registration, String))
pub fn request(event: FetchEvent) -> JsRequest
pub fn respond_with(
  event: FetchEvent,
  response: JsResponse,
) -> 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) -> Nil,
) -> Nil
pub fn service_worker_on_message(handle: fn(Json) -> Nil) -> Nil
pub fn service_worker_post_message(
  worker: ServiceWorker,
  message: Json,
) -> Nil
pub fn skip_waiting(self: GlobalScope) -> Promise(Nil)
pub fn waiting(
  registration: Registration,
) -> Result(ServiceWorker, Nil)
Search Document