[fun-with-rxjs] | Introduction to rxjs main classes and concepts |
- We understood the meaning of a
Stream
- We defined what an
Observer<T>
is and understood that it has 3 methodsnext(T)
complete()
error(err)
- We understood that
Observable<T>
is an object that allows observers to subscribe - We saw how to define an observer explicitly by supplying the 3 methods and their implementation
- We saw how to create an observable using the
interval
operator - We saw that 2 observers that subscribe on different times, get different sets of events that are not synchronized
- We understoof the difference between cold observables and hot observables
- We have seen a few other factory operators:
timer
- creates an observable with time delay. It has two variationstimer(----)
=> ----0|timer(----, --)
=> ----0--1--2--3--4...
of
- wraps a value or values inside a synchronous observableof(42)
=> (42)|of(1, 2, 3)
=> 123|
from
- serves as a multifunction converter between any wrapper to observablefrom([1, 2, 3])
=> [1, 2, 3]|from(Promise ----42|)
=> ----42|
- We saw how to create a custom observable using the observable constructor
- We got familiar with the
Subject
object and understood that it is a hot observable - We saw that a subject can be used as a proxy to "heat" a cold observable
- We learned about
BehaviorSubject
and understood that it is just a subject that sends the latest event to a new observer on the moment of subscription
- We learned how to develop stateful services using
BehaviorSubject
and expose it as an observable using the.asObservable()
method - We understood that if we subscribe to an observable we must also unsubscribe from it when we are done with it to avoid memory leaks
- We saw that we can bind directly to an observable using the
async pipe
in the html - We learned the term Fully Reactive Application as one where we pass observables all the way from the services to the html templates
- We saw how to configure manual change detection for components and understood that it can dramatically improve performance
- We saw how to inject the
ChangeDetectorRef
and to manually activatedetectChanges
to force invalidation of the DOM