| fun-with-promises | Introduction to Promises in Javascript |
| fun-with-rxjs | Introduction to Reactive Extensions to Javascript |
- We understood what
asyncandawaitkeywords do and how do they affect the compilation - We understood that the
.thenmethod, and theasynckeywords, also create promises, out of other promises - We understood what operators are and that we have 3 categories of operators:
- Factories - create promises out of nothing
- Pipeables - create promise out of one promise, and therefore chainable
- Combinators - create promise out of collection of promises
- We saw how to use
Promise.resolveandPromise.rejectas factories to create promises that are already completed. - We saw how to use
Promise.allandPromise.raceto group promises together and wrap them in a single promise that returns all the results from all the promises or from the first one to complete. - Finally we understood how the
Promiseconstructor works- We saw that we provide it with a callback that is executed instantly
- We saw that the Promise constroctor passes to our callbacks 2 functions that can be used to complete the promises, either succesfully with a result or unsuccesfully with an error
- We saw an example of storing the
resolvecallback and then calling it later when the user clicks a button
- We understood the meaning of a
Stream - We defined what an
Observer<T>is and understood that it has 3 methodsnext(T)complete()error(err)
- We understood that
Observable<T>is an object that allows observers to subscribesubscribe(Observer<T>)
- We saw how to define an observer explicitly by supplying the 3 methods and their implementation
- We saw how to create an observable using the
intervaloperator - We saw that 2 observers that subscribe on different times, get different sets of events that are not synchronized
- We understoof the difference between cold observables and hot observables
- We have seen a few other factory operators:
timer- creates an observable with time delay. It has two variationstimer(----)=> ----0|timer(----, --)=> ----0--1--2--3--4...
of- wraps a value or values inside a synchronous observableof(42)=> (42)|of(1, 2, 3)=> 123|
from- serves as a multifunction converter between any wrapper to observablefrom([1, 2, 3])=> [1, 2, 3]|from(Promise ----42|)=> ----42|
- We saw how to create a custom observable using the observable constructor
- We got familiar with the
Subjectobject and understood that it is a hot observable - We learned about
BehaviorSubjectand understood that it is just a subject that sends the latest event to a new observer on the moment of subscription