Notification

Constructors

Link copied to clipboard
constructor(options: NotificationConstructorOptions = definedExternally)

Notification

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

A NotificationAction[] property representing the actions of the notification.

Link copied to clipboard

A string property representing the body of the notification.

Link copied to clipboard
Link copied to clipboard

A string property representing the close button text of the notification.

Link copied to clipboard
Link copied to clipboard

A string property representing the group identifier of the notification. Notifications with the same groupId will be visually grouped together in Notification Center (macOS) or Action Center (Windows).

Link copied to clipboard

A string property representing the title of the notification group header.

Link copied to clipboard

A boolean property representing whether the notification has a reply action.

Link copied to clipboard
val id: String

A string property representing the unique identifier of the notification. This is set at construction time — either from the id option or as a generated UUID if none was provided.

Link copied to clipboard

A string property representing the reply placeholder of the notification.

Link copied to clipboard
Link copied to clipboard

A boolean property representing whether the notification is silent.

Link copied to clipboard

A string property representing the sound of the notification.

Link copied to clipboard

A string property representing the subtitle of the notification.

Link copied to clipboard

A string property representing the type of timeout duration for the notification. Can be 'default' or 'never'.

Link copied to clipboard

A string property representing the title of the notification.

Link copied to clipboard

A string property representing the custom Toast XML of the notification.

Link copied to clipboard

A string property representing the urgency level of the notification. Can be 'normal', 'critical', or 'low'.

Functions

Link copied to clipboard
fun addListener(type: EventType, listener: EventListener)
Link copied to clipboard
fun close()

Dismisses the notification.

Link copied to clipboard
fun emit(type: EventType, vararg args: Any?): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun off(type: EventType, listener: EventListener)
Link copied to clipboard
fun on(type: EventType, listener: EventListener)
Link copied to clipboard
fun once(type: EventType, listener: EventListener)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun removeListener(type: EventType, listener: EventListener)
Link copied to clipboard
Link copied to clipboard
fun show()

Immediately shows the notification to the user. Unlike the web notification API, instantiating a new Notification() does not immediately show it to the user. Instead, you need to call this method before the OS will display it.