Table of Contents

Class NotificationEvent

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The NotificationEvent interface of the {{domxref("Notifications API", "", "", "nocode")}} represents a notification event dispatched on the ServiceWorkerGlobalScope of a ServiceWorker.

[Value("NotificationEvent")]
public class NotificationEvent : ExtendableEvent
Inheritance
NotificationEvent
Inherited Members

Remarks

This interface inherits from the ExtendableEvent interface.

NOTE

Only persistent notification events, fired at the ServiceWorkerGlobalScope object, implement the NotificationEvent interface. Non-persistent notification events, fired at the Notification object, implement the Event interface.

See also on MDN

Constructors

NotificationEvent()

public NotificationEvent()

NotificationEvent(string, NotificationEventInit)

The NotificationEvent() constructor creates a new NotificationEvent object.

public NotificationEvent(string type, NotificationEventInit eventInitDict)

Parameters

type string
eventInitDict NotificationEventInit

Remarks

Properties

Action

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.

[Value("action")]
public string Action { get; }

Property Value

string

A string.

Remarks

Notification

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.

[Value("notification")]
public Notification Notification { get; }

Property Value

Notification

A Notification object.

Remarks