Created
November 4, 2017 13:05
-
-
Save webmaxru/2703e1f6e99cedbbbeb6a1c33b6b26cc to your computer and use it in GitHub Desktop.
Subscribe for the push messages in our app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| showMessages() { | |
| this.swPush.messages | |
| .subscribe(message => { | |
| console.log('[App] Push message received', message) | |
| let notification = message['notification'] | |
| this.tweets.unshift({ | |
| text: notification['body'], | |
| id_str: notification['tag'], | |
| favorite_count: notification['data']['favorite_count'], | |
| retweet_count: notification['data']['retweet_count'], | |
| user: { | |
| name: notification['title'] | |
| } | |
| }) | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment