Created
February 4, 2018 13:46
-
-
Save dpalita/29da53b0b7da955627c6a6e48538963e to your computer and use it in GitHub Desktop.
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
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