This operator is simple and useful, and works similarly to the finally from the try/catch/finally block. It executes a specified function after the original observable finishes (even in the case of failure).
It has the following signature:
It receives only one parameter and it is mandatory:
- action: It is the function to be executed when the original observable finishes, even in the case of failure
This operator is simple and two examples are enough to understand it.
The first example shows its usage in an observable finishing gracefully:
Rx.Observable .just(1) .finally(()=>console.log('FINALLY')) .subscribe((i)=>console.log(i));
If you run this code you will see the following output, ...