Skip to content

Latest commit

 

History

History
62 lines (50 loc) · 2.36 KB

finally.md

File metadata and controls

62 lines (50 loc) · 2.36 KB

Rx.Observable.prototype.finally(action)

Rx.Observable.prototype.finallyAction(action) DEPRECATED

Invokes a specified action after the source observable sequence terminates gracefully or exceptionally. There is an alias called finallyAction for browsers <IE9

Arguments

  1. predicate (Function): A function to test each source element for a condition; The callback is called with the following information:
    1. the value of the element
    2. the index of the element
    3. the Observable object being subscribed
  2. [thisArg] (Any): Object to use as this when executing the predicate.

Returns

(Observable): An observable sequence that contains elements from the input sequence that satisfy the condition.

Example

/* 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: ' + x);
    },
    function (err) {
        console.log('Error: ' + err);
    },
    function () {
        console.log('Completed');
    });

// => Error: Error
// => Finally

Location

File:

Dist:

NPM Packages:

NuGet Packages:

Unit Tests: