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

RxJS Introduction

RxJS Introduction

r31gN_

July 25, 2016
Tweet

More Decks by r31gN_

Other Decks in Technology

Transcript

  1. Current state of UIs • Extremely complex • Full of

    async events, client/server communication • UIs are always composed based on a state • State is hard to reason about
  2. User action UI Responds User action ….. Uses imperative programming

    Uses imperative programming UI Responds time (s)
  3. Caveats of IP • Isolates state from time • You

    don’t see the bigger picture • Mutable values
  4. Streams • Sequence of ongoing events ordered in time •

    Cheap, ubiquitous • Allow you to react to new data • Think event busses, typical click events, etc.
  5. Observable/Observer • Observables are push-based, observable sequences that can send

    data to anyone who is interested • Observers are entities who register an interest through a subscription to an Observable
  6. Observers • Register via subscribe method • You get back

    a Disposable object (a handler for the subscription) • onNext, onError, onCompleted
  7. When to use RxJS • Orchestrate event-based computations • Deal

    with async data • Complex UIs with lots of user interaction