Notification

Constructors

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

Notification

Types

Link copied to clipboard
external object Companion

Properties

Link copied to clipboard

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

Link copied to clipboard
external var body: String

A string property representing the body of the notification.

Link copied to clipboard
Link copied to clipboard
external var closeButtonText: String

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

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
external val groupId: String

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
external val groupTitle: String

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

Link copied to clipboard
external var hasReply: Boolean

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

Link copied to clipboard
external 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
external var replyPlaceholder: String

A string property representing the reply placeholder of the notification.

Link copied to clipboard
external val showEvent: EventInstance<Tuple1<Event<*>>>
Link copied to clipboard
external var silent: Boolean

A boolean property representing whether the notification is silent.

Link copied to clipboard
external var sound: String

A string property representing the sound of the notification.

Link copied to clipboard
external var subtitle: String

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
external var title: String

A string property representing the title of the notification.

Link copied to clipboard
external var toastXml: String

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
external fun addListener(type: EventType, listener: EventListener)
Link copied to clipboard
external fun close()

Dismisses the notification.

Link copied to clipboard
external fun emit(type: EventType, vararg args: Any?): Boolean
Link copied to clipboard
Link copied to clipboard
external fun getMaxListeners(): Double
Link copied to clipboard
external fun listenerCount(type: EventType, listener: EventListener): Double
Link copied to clipboard
Link copied to clipboard
external fun off(type: EventType, listener: EventListener)
Link copied to clipboard
external fun on(type: EventType, listener: EventListener)
Link copied to clipboard
external fun once(type: EventType, listener: EventListener)
Link copied to clipboard
external fun prependListener(type: EventType, listener: EventListener)
Link copied to clipboard
external fun prependOnceListener(type: EventType, listener: EventListener)
Link copied to clipboard
Link copied to clipboard
external fun removeAllListeners(type: EventType)
Link copied to clipboard
external fun removeListener(type: EventType, listener: EventListener)
Link copied to clipboard
external fun setMaxListeners(n: Number)
Link copied to clipboard
external 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.