Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akofman/cordova-plugin-notificationcenter
iOS NSNotificationCenter bridge
https://github.com/akofman/cordova-plugin-notificationcenter
Last synced: 1 day ago
JSON representation
iOS NSNotificationCenter bridge
- Host: GitHub
- URL: https://github.com/akofman/cordova-plugin-notificationcenter
- Owner: akofman
- License: mit
- Created: 2015-05-25T08:03:06.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-07-24T15:39:00.000Z (over 5 years ago)
- Last Synced: 2024-11-14T11:42:29.990Z (30 days ago)
- Language: JavaScript
- Homepage:
- Size: 161 KB
- Stars: 7
- Watchers: 3
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# cordova-plugin-notificationcenter
[![NPM](https://nodei.co/npm/cordova-plugin-notificationcenter.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/cordova-plugin-notificationcenter/)
[Cordova plugin](https://www.npmjs.com/package/cordova-plugin-notificationcenter)
> Bridge between iOS [NSNotificationCenter](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/) and JavaScript.> There are tons of native notifications broadcasted by various components from the iOS SDK.
Sometimes it can be useful to observe them from the JavaScript side.> :warning: This plugin does not handle pushNotifications or localNotifications. This is not the purpose.
## Usage
Add specific observers :
```js
cordova.plugins.notificationCenter.addObserver('NSManagingContextDidSaveChangesNotification',function(){
console.log('NSManagingContextDidSaveChangesNotification has been sent');
});cordova.plugins.notificationCenter.addObserver('UIDeviceOrientationDidChangeNotification',function(){
console.log('UIDeviceOrientationDidChangeNotification has been sent');
});
```
Remove a specific observer :```js
cordova.plugins.notificationCenter.removeObserver('NSManagingContextDidSaveChangesNotification');
```Remove all the added observers :
```js
cordova.plugins.notificationCenter.removeAllObservers();
```Enter the debug mode in order to observe all native notifications ( :warning: do not use this in production ! It's a performance killer ) :
```js
cordova.plugins.notificationCenter.startDebug();
```## License
MIT © [Alexis Kofman](http://twitter.com/alexiskofman)