Skip to content

Instantly share code, notes, and snippets.

@webmaxru
Created November 4, 2017 13:05
Show Gist options
  • Select an option

  • Save webmaxru/2703e1f6e99cedbbbeb6a1c33b6b26cc to your computer and use it in GitHub Desktop.

Select an option

Save webmaxru/2703e1f6e99cedbbbeb6a1c33b6b26cc to your computer and use it in GitHub Desktop.
Subscribe for the push messages in our app
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