ExtendableMessageEvent

The ExtendableMessageEvent interface of the Service Worker API represents the event object of a message event fired on a service worker (when a message is received on the ServiceWorkerGlobalScope from another context) — extends the lifetime of such events.

MDN Reference

Constructors

Link copied to clipboard
constructor(type: EventType<ExtendableMessageEvent>, init: ExtendableMessageEventInit = definedExternally)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
external val bubbles: Boolean
Link copied to clipboard
external val cancelable: Boolean
Link copied to clipboard
external val composed: Boolean
Link copied to clipboard
external val currentTarget: EventTarget?
Link copied to clipboard
external val data: JsAny?

The data read-only property of the ExtendableMessageEvent interface returns the event's data. It can be any data type.

Link copied to clipboard
Link copied to clipboard
external val eventPhase: EventPhase
Link copied to clipboard
external val isTrusted: Boolean
Link copied to clipboard
external val lastEventId: String

The lastEventID read-only property of the ExtendableMessageEvent interface represents, in server-sent events, the last event ID of the event source. This is an empty string.

Link copied to clipboard
external val origin: String

The origin read-only property of the ExtendableMessageEvent interface returns the origin of the Client that sent the message.

Link copied to clipboard

The ports read-only property of the ExtendableMessageEvent interface returns the array containing the MessagePort objects representing the ports of the associated message channel (the channel the message is being sent through.)

Link copied to clipboard
external val source: JsAny?

The source read-only property of the ExtendableMessageEvent interface returns a reference to the Client object from which the message was sent.

Link copied to clipboard
external val target: EventTarget?
Link copied to clipboard
Link copied to clipboard
open external override val type: EventType<ExtendableMessageEvent>

Functions

Link copied to clipboard
Link copied to clipboard
external fun preventDefault()
Link copied to clipboard
Link copied to clipboard
external fun stopPropagation()
Link copied to clipboard
external fun waitUntil(f: Promise<*>)

The ExtendableEvent.waitUntil() method tells the event dispatcher that work is ongoing. It can also be used to detect whether that work was successful. In service workers, waitUntil() tells the browser that work is ongoing until the promise settles, and it shouldn't terminate the service worker if it wants that work to complete.

Link copied to clipboard
fun ExtendableEvent.waitUntil(block: suspend CoroutineScope.() -> Unit)

The ExtendableEvent.waitUntil() method tells the event dispatcher that work is ongoing.