<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "CloudKitJS",
  "identifier" : "/documentation/CloudKitJS/CloudKit.Container/addNotificationListener",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit JS"
    ],
    "preciseIdentifier" : "instm/CloudKit.Container/addNotificationListener"
  },
  "title" : "addNotificationListener"
}
-->

# addNotificationListener

Adds a function to call when a push notification occurs.

```
void addNotificationListener(
	function listener
);
```

## Parameters

`listener`

The function to call when a push notification occurs. The function must have a single argument that is a [`CloudKit.Notification`](/documentation/CloudKitJS/CloudKit.Notification) object.

## Discussion

To subscribe to changes and register for push notifications, see `saveSubscription` in the [`CloudKit.Database`](/documentation/CloudKitJS/CloudKit.Database) class.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)