The Notifications API lets a web page or app send notifications that are displayed outside the page at the system level; this lets web apps send information to a user even if the application is idle or in the background. This article looks at the basics of using this API in your own apps.
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 onclose property of the Notification interface specifies an event listener to receive close events. These events occur when a Notification is closed.
The onshow property of the Notification interface specifies an event listener to receive show events. These events occur when a Notification is displayed.
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 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 Push API gives web applications the ability to receive messages pushed to them from a server, whether or not the web app is in the foreground, or even currently loaded, on a user agent. This lets developers deliver asynchronous notifications and updates to users that opt in, resulting in better engagement with timely new content.
The getNotifications() method of the ServiceWorkerRegistration interface returns a list of the notifications that have been fired from the current service worker.