Next Notification
Next Notification
The next notification is delivered to all Observers when the Observable produces a new value.
We should note that an Observable may omit no next notifications, 1 next notification, or multiple next notifications.
We've already learned how to use the subscribe() method to listen for next notifications.
Here is an example of providing the callback function as the first parameter:
observable.subscribe((value) => {
console.log(value)
});
Here is an example of using an Observer instance:
observable.subscribe({
next: (value) => {
console.log(value);
}
});
Note that we have only provided the next property of the Observer interface as the subscribe method accepts a Partial.