RxJS/Documentation/observable : Différence entre versions

De WikiSys
Aller à : navigation, rechercher
Ligne 20 : Ligne 20 :
  
 
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.
 
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.
 +
 +
=== Subject ===
 +
* http://reactivex.io/documentation/subject.html
 +
 +
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.

Version du 20 juillet 2019 à 18:22

rxjs-dev.firebaseapp.com

reactivex.io

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.

Subject

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.