At the end of September, I watched Rob Wormald give a talk on observables and RxJS entitled, "Everything is a Stream." This talk, along with some advice Rob's given me on an Angular Slack channel, sent me down a rabbit hole of learning about observables, reactive programming, and RxJS. I thought I'd share some of the resources I've found on the subject so you can do less scouring the internet and more learning.
The TL;DR on observables is basically that events can be thought of as streams that can be captured in arrays (mouse-clicks, for example), and those streams of events can then be modified in real time using array functions like filter, map, and reduce. This pairs especially nicely with ES6 due to the addition of iterables, lambda syntax for anonymous functions (that's .NET-speak for "fat arrows"), and a few new array functions. And, unlike promises, observables can be cancelled.
This matters as an Angular developer because in Angular 2, Http (the equivalent of $http in ng1) will return an observable, not a promise. Here are a few resources I've found to be helpful in understanding these concepts:
- Rob's slides from his talk. The video isn't yet available.
- The introduction to Reactive Programming you've been missing by Andre Staltz. This is where you should start, and Rob references this article quite a few times in his talk.
- Egghead.io's Intro to Reactive Programming, also by Andre Staltz. Much of this series requires a Pro subscription, but hey, Egghead is great.
- Reactive Programming with RxJS by Sergi Mansilla, a Pragmatic Bookshelf book. It's still in beta as of November 2015, but you can buy the beta book at a discount and get access to the complete title when it's released.