Skip to content

Latest commit

 

History

History
55 lines (43 loc) · 2 KB

finally.md

File metadata and controls

55 lines (43 loc) · 2 KB

Rx.Observable.prototype.finally(action)

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

Arguments

  1. action (Function): A function to invoke after the source observable sequence terminates.

Returns

(Observable): The source sequence with the side-effecting behavior applied.

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

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

Location

File:

Dist:

NPM Packages:

NuGet Packages:

Unit Tests: