Skip to content

Instantly share code, notes, and snippets.

@dpalita
Created February 4, 2018 13:46
Show Gist options
  • Save dpalita/29da53b0b7da955627c6a6e48538963e to your computer and use it in GitHub Desktop.
Save dpalita/29da53b0b7da955627c6a6e48538963e to your computer and use it in GitHub Desktop.
function handleNotifications () {
const notifications = getNotifications() // as Notification[]
log(notifications)
displayNotificationCounter(notifications.length)
updateNotificationPanel(notifications)
...
}
// vs différents blocs indépendants du moment que l'observable de notifications est accessible
const notifications$ = getNotifications() // as Observable<Notification[]>
notifications$.subscribe(notifs => log(notifs))
notifications$.map(notifs => notifs.length).subscribe(count => displayNotificationCounter(count))
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment