Client

open class Client(source)

The Client interface represents an executable context such as a Worker, or a SharedWorker. Window clients are represented by the more-specific WindowClient. You can get Client/WindowClient objects from methods such as Clients.matchAll() and Clients.get().

MDN Reference

Inheritors

Properties

Link copied to clipboard

The frameType read-only property of the Client interface indicates the type of browsing context of the current Client. This value can be one of "auxiliary", "top-level", "nested", or "none".

Link copied to clipboard
val id: String

The id read-only property of the Client interface returns the universally unique identifier of the Client object.

Link copied to clipboard

The type read-only property of the Client interface indicates the type of client the service worker is controlling.

Link copied to clipboard
val url: String

The url read-only property of the Client interface returns the URL of the current service worker client.

Functions

Link copied to clipboard
fun postMessage(message: String, transfer: ReadonlyArray<Transferable>)
fun postMessage(message: String, options: StructuredSerializeOptions = definedExternally)
fun postMessage(message: JsAny?, options: StructuredSerializeOptions = definedExternally)

fun postMessage(message: JsAny?, transfer: ReadonlyArray<Transferable>)

The postMessage() method of the Client interface allows a service worker to send a message to a client (a Window, Worker, or SharedWorker). The message is received in the message event on navigator.serviceWorker.