Notification

@JSGlobal("Notification") @native @JSType
class Notification(title: String, options: NotificationOptions) extends EventTarget

The Notification interface allows to notify users of an incoming message or event.

NOTE: requires permission Note: This feature is available in Web Workers.

Value parameters:
options

The options to configure this notification

title

The text title of the notification

Returns:

a new Notification

Companion:
object
class Object
trait Any
class Object
trait Matchable
class Any

Value members

Concrete methods

def close(): Unit

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

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

Inherited methods

def addEventListener[T <: Event](`type`: String, listener: Function1[T, _], options: EventListenerOptions): Unit

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

This implementation accepts a settings object of type EventListenerOptions.

Inherited from:
EventTarget
def addEventListener[T <: Event](`type`: String, listener: Function1[T, _], useCapture: Boolean): Unit

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on. The event target may be an Element in a document, the Document itself, a Window, or any other object that supports events (such as XMLHttpRequest).

Inherited from:
EventTarget
def dispatchEvent(evt: Event): Boolean

Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().

Dispatches an Event at the specified EventTarget, invoking the affected EventListeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) apply to events dispatched manually with dispatchEvent().

Inherited from:
EventTarget
def hasOwnProperty(v: String): Boolean
Inherited from:
Object
def isPrototypeOf(v: Object): Boolean
Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from:
Object
def removeEventListener[T <: Event](`type`: String, listener: Function1[T, _], options: EventListenerOptions): Unit

Removes the event listener previously registered with EventTarget.addEventListener.

Removes the event listener previously registered with EventTarget.addEventListener.

This implementation accepts a settings object of type EventListenerOptions.

Inherited from:
EventTarget
def removeEventListener[T <: Event](`type`: String, listener: Function1[T, _], useCapture: Boolean): Unit

Removes the event listener previously registered with EventTarget.addEventListener.

Removes the event listener previously registered with EventTarget.addEventListener.

Inherited from:
EventTarget
def toLocaleString(): String
Inherited from:
Object
def valueOf(): Any
Inherited from:
Object

Concrete fields

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.

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.

val data: Object

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.

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.

The notification's data can be any arbitrary data that you want associated with the notification.

val dir: String

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

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

val icon: String

The icon read-only property of the Notification interface contains the URL of an icon to be displayed as part of the notification, as specified in the icon option of the Notification() constructor.

The icon read-only property of the Notification interface contains the URL of an icon to be displayed as part of the notification, as specified in the icon option of the Notification() constructor.

val lang: String

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

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

val noscreen: Boolean

The noscreen read-only property of the Notification interface specifies whether the notification firing should enable the device's screen or not, as specified in the noscreen option of the Notification() constructor.

The noscreen read-only property of the Notification interface specifies whether the notification firing should enable the device's screen or not, as specified in the noscreen option of the Notification() constructor.

var onclick: Function1[Event, Any]

The onclick property of the Notification interface specifies an event listener to receive click events. These events occur when the user clicks on a displayed Notification.

The onclick property of the Notification interface specifies an event listener to receive click events. These events occur when the user clicks on a displayed Notification.

var onerror: Function1[ErrorEvent, Any]

The onerror property of the Notification interface specifies an event listener to receive error events. These events occur when something goes wrong with a Notification (in many cases an error preventing the notification from being displayed.)

The onerror property of the Notification interface specifies an event listener to receive error events. These events occur when something goes wrong with a Notification (in many cases an error preventing the notification from being displayed.)

val renotify: Boolean

The renotify read-only property of the Notification interface specifies whether the user should be notified after a new notification replaces an old one, as specified in the renotify option of the Notification() constructor.

The renotify read-only property of the Notification interface specifies whether the user should be notified after a new notification replaces an old one, as specified in the renotify option of the Notification() constructor.

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 specified in the renotify option of the Notification() constructor.

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 specified in the renotify option of the Notification() constructor.

val sound: String

The sound read-only property of the Notification interface specifies the URL of an audio file to be played when the notification fires. This is specified in the sound option of the Notification() constructor.

The sound read-only property of the Notification interface specifies the URL of an audio file to be played when the notification fires. This is specified in the sound option of the Notification() constructor.

val sticky: Boolean

The sticky read-only property of the Notification interface specifies whether the notification should be 'sticky', i.e. not easily clearable by the user. This is specified in the sticky option of the Notification() constructor.

The sticky read-only property of the Notification interface specifies whether the notification should be 'sticky', i.e. not easily clearable by the user. This is specified in the sticky option of the Notification() constructor.

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.

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.

The idea of notification tags is that more than one notification can share the same tag, linking them together. One notification can then be programmatically replaced with another to avoid the users' screen being filled up with a huge number of similar notifications.

val vibrate: Array[Double]

The vibrate read-only property of the Notification interface. Specifies a vibration pattern for devices with vibration hardware to emit.

The vibrate read-only property of the Notification interface. Specifies a vibration pattern for devices with vibration hardware to emit.