a zip code crypto-currency system good for red ONLY

finalize.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4. function __() { this.constructor = d; }
  5. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6. };
  7. var Subscriber_1 = require('../Subscriber');
  8. var Subscription_1 = require('../Subscription');
  9. /**
  10. * Returns an Observable that mirrors the source Observable, but will call a specified function when
  11. * the source terminates on complete or error.
  12. * @param {function} callback Function to be called when source terminates.
  13. * @return {Observable} An Observable that mirrors the source, but will call the specified function on termination.
  14. * @method finally
  15. * @owner Observable
  16. */
  17. function finalize(callback) {
  18. return function (source) { return source.lift(new FinallyOperator(callback)); };
  19. }
  20. exports.finalize = finalize;
  21. var FinallyOperator = (function () {
  22. function FinallyOperator(callback) {
  23. this.callback = callback;
  24. }
  25. FinallyOperator.prototype.call = function (subscriber, source) {
  26. return source.subscribe(new FinallySubscriber(subscriber, this.callback));
  27. };
  28. return FinallyOperator;
  29. }());
  30. /**
  31. * We need this JSDoc comment for affecting ESDoc.
  32. * @ignore
  33. * @extends {Ignored}
  34. */
  35. var FinallySubscriber = (function (_super) {
  36. __extends(FinallySubscriber, _super);
  37. function FinallySubscriber(destination, callback) {
  38. _super.call(this, destination);
  39. this.add(new Subscription_1.Subscription(callback));
  40. }
  41. return FinallySubscriber;
  42. }(Subscriber_1.Subscriber));
  43. //# sourceMappingURL=finalize.js.map