Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 104059c

Browse files
EddyVerbruggeneddyverbruggen
authored andcommitted
send push notifications from app + small callback fix for push #286
1 parent 9bc466e commit 104059c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/MESSAGING.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,26 @@ To listen to received notifications while in the foreground or when your app mov
7272

7373
Any pending notifications (while your app was not in the foreground) will trigger the `onMessageReceivedCallback` handler.
7474

75+
##### JavaScript
7576
```js
7677
firebase.init({
7778
onMessageReceivedCallback: function(message) {
7879
console.log("Title: " + message.title);
7980
console.log("Body: " + message.body);
8081
// if your server passed a custom property called 'foo', then do this:
81-
console.log("Value of 'foo': " + message.foo);
82+
console.log("Value of 'foo': " + message.data.foo);
83+
}
84+
});
85+
```
86+
87+
##### TypeScript
88+
```js
89+
firebase.init({
90+
onMessageReceivedCallback: function(message: Message) {
91+
console.log(`Title: ${message.title}`);
92+
console.log(`Body: ${message.body}`);
93+
// if your server passed a custom property called 'foo', then do this:
94+
console.log(`Value of 'foo': ${message.data.foo}`);
8295
}
8396
});
8497
```

0 commit comments

Comments
 (0)