Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RxJS in 5 Minutes

RxJS in 5 Minutes

Aliaksei Kuncevič

June 11, 2020
Tweet

More Decks by Aliaksei Kuncevič

Other Decks in Programming

Transcript

  1. kuncevic.dev @kuncevic Angular Minsk (BY) Frontend Tech (AU) COMMUNITY Angular

    Workshop Angular Sydney (AU) TEACHING‍ kuncevic.dev
  2. kuncevic.dev @kuncevic CREATOR Aurelia vs React vs Vue vs Svelte

    vs Ember vs Elm vs Angular frontendwatch.com
  3. kuncevic.dev Rx extensions for Languages ✅ Java: RxJava ✅ JavaScript:

    RxJS ✅ C#: Rx.NET ✅ C#(Unity): UniRx ✅ Scala: RxScala ✅ Clojure: RxClojure ✅ C++: RxCpp ✅ Lua: RxLua ✅ Ruby: Rx.rb ✅ Rust: rxRust ✅ Python: RxPY ✅ Go: RxGo ✅ Groovy: RxGroovy ✅ JRuby: RxJRuby ✅ Kotlin: RxKotlin ✅ Swift: RxSwift ✅ PHP: RxPHP ✅ Elixir: reaxive ✅ Dart: RxDart
  4. kuncevic.dev Observable vs Promise Emits multiple values over period of

    time Emits only single value at a time Lazy (Cold). Observable is not called until we subscribe for it. Not Lazy (Hot).It is executed without calling then or catch Can be canceled by calling unsubscribe Not cancellable Supports operators like map, forEach, reduce, retry, retryWhen Operators are not available We can chain observables to handle complex logic on the streams We can use only then clause Predictable error handling Pushes errors down the chain
  5. kuncevic.dev Common RxJS operators Area Operators Creation from,fromEvent, of Combination

    combineLatest, concat, merge, zip, startWith , withLatestFrom Filtering debounceTime, distinctUntilChanged, filter, take, takeUntil Transformation bufferTime, concatMap, map, mergeMap, scan, switchMap Utility tap Multicasting share
  6. kuncevic.dev Main Features ✅ Cancelable ✅ Predictable error handling ✅

    Extensive list of operators ✅ Guaranteed teardown of resources ✅ Keeps you away from 'callback hell'
  7. kuncevic.dev Who is using RxJS? ✅ Microsoft ✅ Google(YouTube) ✅

    Sony (PlayStation) ✅ Netflix ✅ Canva ✅ Slack ✅ Your company?