PushEvent

open class PushEvent(val type: EventType<PushEvent>, init: PushEventInit = definedExternally) : ExtendableEvent(source)

The PushEvent interface of the Push API represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription. Available only in secure contexts.

MDN Reference

Constructors

Link copied to clipboard
constructor(type: EventType<PushEvent>, init: PushEventInit = 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: PushMessageData?

The data read-only property of the PushEvent interface returns a reference to a PushMessageData object containing data sent to the PushSubscription.

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 target: EventTarget?
Link copied to clipboard
Link copied to clipboard
open external override val type: EventType<PushEvent>

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.