This document provides an overview of RxJS, a library for composing asynchronous and event-based programs using observable sequences. It discusses key RxJS concepts like Observables, Observers, Operators, and how to create and use Observables. It also provides learning resources and highlights improvements in RxJS 5 like compliance with the Observable specification and better performance.
25. Observable
abstracts data source that accepts an observer and returns
a subscription
ties a producer to a consumer
is by default lazy, and cold*
provides a mechanism to unsubscribe / teardown
function that takes an Observer
*Demystifying Cold and Hot Observables in RxJS
26. Observer
is a consumer of events propagated by the Observable
.next() method handles pushed values
.error() method handles pushed errors
.complete() method handles that the "stream is over"
27. Subject
is a special type (multicast) Observable
similar to EventEmitter - maintains subscribers
differs from Observables which are by default unicast
Every Subject is an Observable - subscribe
Every Subject is an Observer - next, error, complete
BehaviorSubject, ReplaySubject, and AsyncSubject.
28. Operator
transforms source stream into destination stream
joins subscription
applies a projection function, e.g map()
returns an Observable that subscribes to the source
Observable