De WikiSys
Aller à : navigation, rechercher



In ReactiveX an observer subscribes to an Observable.

Then that observer reacts to whatever item or sequence of items the Observable emits.

This pattern facilitates concurrent operations because it does not need to block while waiting for the Observable to emit objects, but instead it creates a sentry in the form of an observer that stands ready to react appropriately at whatever future time the Observable does so.

Observable Operators

Chaining Operators

Most operators operate on an Observable and return an Observable.

This allows you to apply these operators one after the other, in a chain. Each operator in the chain modifies the Observable that results from the operation of the previous operator.


A Subject is a sort of bridge or proxy that is available in some implementations of ReactiveX that acts both as an observer and as an Observable.

Because it is an observer, it can subscribe to one or more Observables, and because it is an Observable, it can pass through the items it observes by reemitting them, and it can also emit new items.


When an observer subscribes to a BehaviorSubject,

  • it begins by emitting the item most recently emitted by the source Observable (or a seed/default value if none has yet been emitted)
  • and then continues to emit any other items emitted later by the source Observable(s).