MDN self-hosted library · e01.org

Notification: actions property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
// sw.js
self.addEventListener("notificationclick", (event) => {
  const clickedAction = event.action; // e.g. "reply" or "" if body was clicked

  // Read all defined actions
  const notification = event.notification; // the Notification object
  console.log(notification.actions); // full array of action objects

  notification.close();
});