Skip to content
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.

Latest commit

 

History

History
56 lines (44 loc) · 2.08 KB

finally.md

File metadata and controls

56 lines (44 loc) · 2.08 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: