What is Observable ?

We can think of Observable as a function that “throws” values. It can “throw” values in synchrony or asynchrony way. If you have interest on this values, you can register observer.

The Observer:

The Observer is an object, with three functions.

  1. next() => Observable, please call this function when you have a new value for me.
  2. error() =>Observable, please call this function when you have a new error for me.
  3. complete() => Observable, please call this function when you complete your job.

When the Observable ( i.e., function ) “throws” new value, error or completes, he will call the corresponding function on your observer.

Source: https://netbasal.com/javascript-observables-under-the-hood-2423f760584

Observable is a part of big RxJs library, here

results matching ""

    No results matching ""