RxJS core concepts
RxJS consists of some core concepts that are important for you to understand early on. Those are:
- Observable: This is a class representing a stream of data.
- Observer: This is a class able to emit data.
- Producer: This is what internally produces data, which the Observer ultimately emits.
- Operator: This is a method on an Observable, which allows us to manipulate the stream itself or the data it emits.
- Stream: This is synonymous with an instance of an Observable. The reason for it being called a stream is that you should think of the data as continuous and not really having an end, unless you explicitly define an end.
Observable and Observer
Having defined all the concepts we need to know initially, it is now time to put it all in context to further our understanding. Let's start off by defining an Observable
and work ourselves into each previously mentioned concept. An Observable
can be created with the following code:
let stream$ = Rx.Observable.create(observer => observer.next...