node-ancs
所属分类:JavaScript/JQuery
开发工具:JavaScript
文件大小:6KB
下载次数:0
上传日期:2015-07-26 15:10:19
上 传 者:
sh-1993
说明: 用于访问Apple通知中心服务(ANCS)的node.js库
(A node.js lib to access the Apple Notification Center Service (ANCS))
文件列表:
LICENSE (1081, 2015-07-26)
index.js (40, 2015-07-26)
lib (0, 2015-07-26)
lib\ancs.js (3444, 2015-07-26)
lib\notification.js (5255, 2015-07-26)
package.json (686, 2015-07-26)
test.js (1191, 2015-07-26)
# ancs
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sandeepmistry/node-ancs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
A node.js lib to access the [Apple Notification Center Service (ANCS)](https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Introduction/Introduction.html)
## Install
```sh
npm install ancs
```
## Prerequisites
* iOS 7 device with an app in peripheral mode which exposes ANCS
* your iOS device will ask to be paired with your Mac
## Usage
```javascript
var ANCS = require('ancs');
```
### Discover
```javascript
ANCS.discover(callback(ancs));
```
### Connect
```javascript
ancs.connect(callback);
```
### Disconnect
```javascript
ancs.disconnect(callback);
```
### Notification Event
```javascript
ancs.on('notification', function(notification) {
// ...
});
```
* notification has the following properties
* event (one of):
* added
* modified
* removed
* flags (array):
* silent
* important
* category (one of):
* other
* incomingCall
* missedCall
* voicemail
* schedule
* email
* other
* news
* healthAndFitness
* businessAndFinance
* location
* entertianment
* categoryCount
* uid
### Operations for 'added' or 'modified' notifications (event property)
#### Read App Identifier
```javascript
notification.readAppIdentifier(function(appIdentifier) {
// ...
});
```
#### Read Title
```javascript
notification.readTitle(function(title) {
// ...
});
```
#### Read Subtitle
```javascript
notification.readSubtitle(function(subtitle) {
// ...
});
```
#### Read Message
```javascript
notification.readMessage(function(message) {
// ...
});
```
#### Read Date
```javascript
notification.readDate(function(date) {
// ...
});
```
#### Read All Attributes
```javascript
notification.readAttributes(function(attributes) {
// ...
});
```
* attributes has the following properties
* appIdentifier
* title
* subtitle
* message
* date
[![Analytics](https://ga-beacon.appspot.com/UA-56089547-1/sandeepmistry/node-ancs?pixel)](https://github.com/igrigorik/ga-beacon)
近期下载者:
相关文件:
收藏者: