Notification

open class Notification(val title: String, options: NotificationOptions = definedExternally) : EventTarget(source)

The Notification interface of the Notifications API is used to configure and display desktop notifications to the user.

MDN Reference

Constructors

Link copied to clipboard
constructor(title: String, options: NotificationOptions = definedExternally)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The actions read-only property of the Notification interface provides the actions available for users to select when interacting with the notification.

Link copied to clipboard
open external val body: String

The body read-only property of the Notification interface indicates the body string of the notification, as specified in the body option of the Notification() constructor.

Link copied to clipboard
open external val data: JsAny?

The data read-only property of the Notification interface returns a structured clone of the notification's data, as specified in the data option of the Notification() constructor.

Link copied to clipboard
open external val dir: NotificationDirection

The dir read-only property of the Notification interface indicates the text direction of the notification, as specified in the dir option of the Notification() constructor.

Link copied to clipboard
open external val icon: String

The icon read-only property of the Notification interface returns a string containing the URL of a small image that reinforces the notification — for example, an app logo or a photo of the message sender. It is displayed alongside the notification title and body.

Link copied to clipboard
open external val lang: String

The lang read-only property of the Notification interface indicates the language used in the notification, as specified in the lang option of the Notification() constructor.

Link copied to clipboard
open external val navigate: String

The navigate read-only property of the Notification interface contains the URL the user agent will navigate to when the user activates the notification.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open external val requireInteraction: Boolean

The requireInteraction read-only property of the Notification interface returns a boolean value indicating that a notification should remain active until the user clicks or dismisses it, rather than closing automatically.

Link copied to clipboard
open external val silent: Boolean?

The silent read-only property of the Notification interface specifies whether the notification should be silent, i.e., no sounds or vibrations should be issued regardless of the device settings. This is controlled via the silent option of the Notification() constructor.

Link copied to clipboard
open external val tag: String

The tag read-only property of the Notification interface signifies an identifying tag for the notification, as specified in the tag option of the Notification() constructor.

Link copied to clipboard
open external val title: String

The title read-only property of the Notification interface indicates the title of the notification, as specified in the title parameter of the Notification() constructor.

Functions

Link copied to clipboard
open external fun close()

The close() method of the Notification interface is used to close/remove a previously displayed notification.

Link copied to clipboard
open external override fun dispatchEvent(event: Event): Boolean
Link copied to clipboard
open external fun <T : Event> when(type: EventType<T>, options: ObservableEventListenerOptions?): Observable<T>