Invokes a specified action after the source observable sequence terminates gracefully or exceptionally. There is an alias called finallyAction
for browsers <IE9
predicate
(Function
): A function to test each source element for a condition; The callback is called with the following information:- the value of the element
- the index of the element
- the Observable object being subscribed
[thisArg]
(Any
): Object to use asthis
when executing the predicate.
(Observable
): An observable sequence that contains elements from the input sequence that satisfy the condition.
/* 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: