Observables are another pattern for dealing with async. They provide a somewhat similar API to what arrays provide, in that you can call map filter reduce etc on them, which act on the events emitted.
The biggest difference between promises and observables is that a promise will only resolve once and return a single value, whereas observables can emit many values over time.
You can use observables to represent click events, websocket events, pretty much anything.
I mentioned a few implementions below, besides just RxJS, but there is an official proposal for them to be added to the spec.
1
u/[deleted] Oct 23 '17
Is using Observable (since they're cancelable) any better ?