Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2011 from jacquesdev/master
Browse files Browse the repository at this point in the history
Keep docs up to date with es6
  • Loading branch information
fredgalvao committed Oct 13, 2017
2 parents d39520f + 34ea498 commit 073d6be
Show file tree
Hide file tree
Showing 4 changed files with 183 additions and 185 deletions.
46 changes: 22 additions & 24 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Make sure that the certificate you build with matches your `fcmSandbox` value.
### Example

```javascript
var push = PushNotification.init({
const push = PushNotification.init({
android: {
},
browser: {
Expand Down Expand Up @@ -136,7 +136,7 @@ Parameter | Type | Description
### Example

```javascript
PushNotification.hasPermission(function(data) {
PushNotification.hasPermission((data) => {
if (data.isEnabled) {
console.log('isEnabled');
}
Expand Down Expand Up @@ -166,7 +166,7 @@ Parameter | Type | Description
### Example

```javascript
push.on('registration', function(data) {
push.on('registration', (data) => {
console.log(data.registrationId);
console.log(data.registrationType);
});
Expand Down Expand Up @@ -212,7 +212,7 @@ Parameter | Type | Description
### Example

```javascript
push.on('notification', function(data) {
push.on('notification', (data) => {
console.log(data.message);
console.log(data.title);
console.log(data.count);
Expand All @@ -235,7 +235,7 @@ Parameter | Type | Description
### Example

```javascript
push.on('error', function(e) {
push.on('error', (e) => {
console.log(e.message);
});
```
Expand All @@ -253,7 +253,7 @@ Parameter | Type | Default | Description

### Example
```javascript
var callback = function(data){ /*...*/};
const callback = (data) => { /*...*/};

//Adding handler for notification event
push.on('notification', callback);
Expand Down Expand Up @@ -281,9 +281,9 @@ Parameter | Type | Default | Description
### Example

```javascript
push.unregister(function() {
push.unregister(() => {
console.log('success');
}, function() {
}, () => {
console.log('error');
});
```
Expand All @@ -303,11 +303,10 @@ Parameter | Type | Default | Description
### Example

```javascript
push.subscribe('my-topic', function() {
push.subscribe('my-topic', () => {
console.log('success');
}, function(e) {
console.log('error:');
console.log(e);
}, (e) => {
console.log('error:', e);
});
```
## push.unsubscribe(topic, successHandler, errorHandler)
Expand All @@ -325,11 +324,10 @@ Parameter | Type | Default | Description
### Example

```javascript
push.unsubscribe('my-topic', function() {
push.unsubscribe('my-topic', () => {
console.log('success');
}, function(e) {
console.log('error:');
console.log(e);
}, (e) => {
console.log('error:', e);
});
```

Expand All @@ -350,9 +348,9 @@ Parameter | Type | Default | Description
### Example

```javascript
push.setApplicationIconBadgeNumber(function() {
push.setApplicationIconBadgeNumber(() => {
console.log('success');
}, function() {
}, () => {
console.log('error');
}, 2);
```
Expand All @@ -379,9 +377,9 @@ Parameter | Type | Description
### Example

```javascript
push.getApplicationIconBadgeNumber(function(n) {
push.getApplicationIconBadgeNumber((n) => {
console.log('success', n);
}, function() {
}, () => {
console.log('error');
});
```
Expand All @@ -401,9 +399,9 @@ Parameter | Type | Default | Description
### Example

```javascript
push.finish(function() {
push.finish(() => {
console.log('success');
}, function() {
}, () => {
console.log('error');
}, 'push-1');
```
Expand All @@ -422,9 +420,9 @@ Parameter | Type | Default | Description
### Example

```javascript
push.clearAllNotifications(function() {
push.clearAllNotifications(() => {
console.log('success');
}, function() {
}, () => {
console.log('error');
});
```
8 changes: 4 additions & 4 deletions docs/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ phonegap create my-app --template phonegap-template-push
## Quick Example

```javascript
var push = PushNotification.init({
const push = PushNotification.init({
android: {
},
browser: {
Expand All @@ -23,11 +23,11 @@ var push = PushNotification.init({
windows: {}
});

push.on('registration', function(data) {
push.on('registration', (data) => {
// data.registrationId
});

push.on('notification', function(data) {
push.on('notification', (data) => {
// data.message,
// data.title,
// data.count,
Expand All @@ -36,7 +36,7 @@ push.on('notification', function(data) {
// data.additionalData
});

push.on('error', function(e) {
push.on('error', (e) => {
// e.message
});
```
Loading

0 comments on commit 073d6be

Please sign in to comment.