NotificationEvent

The NotificationEvent interface of the Notifications API represents a notification event dispatched on the ServiceWorkerGlobalScope of a ServiceWorker.

MDN Reference

Constructors

Link copied to clipboard

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
external val action: String

The action read-only property of the NotificationEvent interface returns the string ID of the notification button the user clicked. This value returns an empty string if the user clicked the notification somewhere other than an action button, or the notification does not have a button. The notification id is set during the creation of the Notification via the actions array attribute and can't be modified unless the notification is replaced.

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
Link copied to clipboard
external val eventPhase: EventPhase
Link copied to clipboard
external val isTrusted: Boolean
Link copied to clipboard

The notification read-only property of the NotificationEvent interface returns the instance of the Notification that was clicked to fire the event. The Notification provides read-only access to many properties that were set at the instantiation time of the Notification such as tag and data attributes that allow you to store information for deferred use in the notificationclick event.

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

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.