This is RxJS v 4. Find the latest version here
Invokes a specified action after the source observable sequence terminates gracefully or exceptionally. There is an alias called finallyAction
for browsers <IE9
action
(Function
): A function to invoke after the source observable sequence terminates.
(Observable
): The source sequence with the side-effecting behavior applied.
/* Terminated by error still fires function */
var source = Rx.Observable.throw(new Error())
.finally(function () { console.log('Finally'); });
var subscription = source.subscribe(
function (x) {
console.log('Next: %s', x);
},
function (err) {
console.log('Error: %s', err);
},
function () {
console.log('Completed');
});
// => Error: Error
// => Finally
File:
Dist:
NPM Packages:
NuGet Packages:
Unit Tests: