Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

What is a stream?

A stream is a sequence of ongoing events ordered in time.
It can emit three different things:
1. a value (of some type)
2. an error
3. a "completed" signal

Consider that the "completed" takes place, for instance, when the current window or view containing that button is closed.

We capture these emitted events only asynchronously, by defining a function that will execute when a value is emitted, another function when an error is emitted, and another function when 'completed' is emitted.
Sometimes these last two can be omitted and you can just focus on defining the function for values.
The "listening" to the stream is called subscribing.
The functions we are defining are observers.
The stream is the subject (or "observable") being observed.
This is precisely the Observer Design Pattern.


=================================================

--a---b-c---d---X---|->

a, b, c, d are emitted values

X is an error

| is the 'completed' signal

---> is the timeline

=================================================

 

Reactive Programing (observables & Rxjs) - What is a stream?

Tomas Katz
Module by Tomas Katz, updated more than 1 year ago

Description

Reactive Programing (observables & Rxjs) - What is a stream?
No tags specified