Skip to content

Instantly share code, notes, and snippets.

@MatLang
Last active July 4, 2019 12:21
Show Gist options
  • Save MatLang/e4261c2e389d6aef969c81d1060054ef to your computer and use it in GitHub Desktop.
Save MatLang/e4261c2e389d6aef969c81d1060054ef to your computer and use it in GitHub Desktop.
Angular RxJS Course #rxjs #summary
  • Streams vs Observables
  • Error handling in subscribe
  • Create observable that handles fetch request
  • Noop
  • Map
  • Example of reactive design: beginner courses and advanced courses with individual observables based on 1 http observable and 1 courses observable filtering out the payload of the fetch request => too many http requests
  • tap()
  • shareReplay()
  • concat()
  • filter()
  • of(), fromPromise(), from()
  • concatMap()
  • merge()
  • mergeMap()
  • exhaustMap() + AbortController
  • debounceTime()
  • switchMap()
  • catchError() + throwError() + response.ok
  • finalize()
  • retryWhen() + delayWhen()

Example:

retryWhen(errors => errors.pipe(delayWhen(() => timer(2000)));
  • startWith()
  • throttleTime() / throttle()
throttle(() => interval(500));
  • custom operator
const debug = (message) => {
	return (source: Observable<any>) => {
    	return source.pipe(
        	tap(val => console.log(message))
        );
    }
}
  • forkJoin()

  • createHttpObservable function

  • Subject = Observable and Observer at the same time

    • Subject is meant to be private to any component
    • If you want to share the subject then use subject.asObservable()
  • BehaviorSubject()

  • AsyncSubject()

    • What happens to late subscribers?
  • ReplaySubject()

    • What happens to late subscribers?
  • first(), take(x)

  • withLatestFrom()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment