RxJS — Six Operators That you Must Know – NetanelBasal

  • Don’t let me know until all the Observables are complete, then give me all the values at once.
  • Let me know when the Observable emits, but also give me the previous value.
  • Use the operator when the order is important, for example when you need to send HTTP requests that should be in order.
  • Subscribe to Observables in order but only when the previous completes, let me know, then move to the next one.
  • The operator is very useful when you need for example to deal with filters in your app.

Use this operator when the order is important, for example when you need to send HTTP requests that should be in order. In our example, every time I’m clicking on the document, the previous interval…

@JavaScriptKicks: RxJS – Six Operators That you Must Know by @NetanelBasal #javascript #angularjs #rxjs via @JavaScriptKicks

1. Concat —

Subscribe to Observables in order but only when the previous completes, let me know, then move to the next one.

Use this operator when the order is important, for example when you need to send HTTP requests that should be in order.

2. forkJoin —

of Rx.

Don’t let me know until all the Observables are complete, then give me all the values at once. ( Array )

Use this operator when you don’t care about the order.

3. mergeMap —

First, let’s understand two terms in the Observables world:

Only when the inner Observable emits, let me know by merging the value to the outer Observable.

4. pairwise —

Let me know when the Observable emits, but also give me the previous value. ( Array )

Scrolling…

Triggers on the second and subsequent triggerings of the input Observable.

5. switchMap —

Like mergeMap but when the source Observable emits cancel any previous subscriptions of the inner Observable.

subscription will cancel, and a new one will start.

6. combineLatest —

Let me know when any Observable emits but also give me the latest value from the others. ( Array )

This operator is very useful when you need for example to deal with filters in your app.

If you want to know more about Observables you can read my articles:

RxJS — Six Operators That you Must Know – NetanelBasal

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.