Skip to content

UNNotificationResponse: notification property ​

The notification property is the notification the user acted on.

Value ​

A UNNotification.

  • Read-only. Assigning to it throws TypeError: notification is read-only.

Examples ​

js
const center = UNUserNotificationCenter.currentNotificationCenter();
center.addEventListener('notificationclick', (event) => {
  const info = event.response.notification.request.content.userInfo;
  console.log(JSON.stringify(info));
});

Effect (not verified in the simulator): when the user taps a notification, prints the data originally put in its content.

Corresponding iOS API ​

UNNotificationResponse.notification.

See also ​