Skip to content

Latest commit

 

History

History
12 lines (7 loc) · 1.22 KB

readme.md

File metadata and controls

12 lines (7 loc) · 1.22 KB

Observables versus Promises

In these exercises, you will learn the differences between Promises and Observables. Promises have been around for a while, implemented in such libraries as jQuery, Dojo, AngularJS as well as dedicated libraries such as Q, Bluebird, lie and others. Recently, this type has been standardized as part of the ES2015 specification. Similarly, Observables are also undergoing standardization and will hopefully be available in ES2016.

You will learn the subtle differences between Promises and Observables as Promises wrap asynchronous single values, whereas Observables wrap synchronous and asynchronous collections which may yield zero to an infinite amount of values. Observables also by default support a notion of cancelation. When you call subscribe on an Observable, you get back a subscription which you can dispose at any time to cancel an operation if it has not completed, but also to clean up any resources such as event handlers.

For more information about Observables, check out the RxJS Documentation

Exercises

  1. Problem - Solution
  2. Problem - Solution