Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. }
  9. return function (d, b) {
  10. extendStatics(d, b);
  11. function __() { this.constructor = d; }
  12. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13. };
  14. })();
  15. Object.defineProperty(exports, "__esModule", { value: true });
  16. var Subscriber_1 = require("../Subscriber");
  17. var noop_1 = require("../util/noop");
  18. var isFunction_1 = require("../util/isFunction");
  19. function tap(nextOrObserver, error, complete) {
  20. return function tapOperatorFunction(source) {
  21. return source.lift(new DoOperator(nextOrObserver, error, complete));
  22. };
  23. }
  24. exports.tap = tap;
  25. var DoOperator = (function () {
  26. function DoOperator(nextOrObserver, error, complete) {
  27. this.nextOrObserver = nextOrObserver;
  28. this.error = error;
  29. this.complete = complete;
  30. }
  31. DoOperator.prototype.call = function (subscriber, source) {
  32. return source.subscribe(new TapSubscriber(subscriber, this.nextOrObserver, this.error, this.complete));
  33. };
  34. return DoOperator;
  35. }());
  36. var TapSubscriber = (function (_super) {
  37. __extends(TapSubscriber, _super);
  38. function TapSubscriber(destination, observerOrNext, error, complete) {
  39. var _this = _super.call(this, destination) || this;
  40. _this._tapNext = noop_1.noop;
  41. _this._tapError = noop_1.noop;
  42. _this._tapComplete = noop_1.noop;
  43. _this._tapError = error || noop_1.noop;
  44. _this._tapComplete = complete || noop_1.noop;
  45. if (isFunction_1.isFunction(observerOrNext)) {
  46. _this._context = _this;
  47. _this._tapNext = observerOrNext;
  48. }
  49. else if (observerOrNext) {
  50. _this._context = observerOrNext;
  51. _this._tapNext = observerOrNext.next || noop_1.noop;
  52. _this._tapError = observerOrNext.error || noop_1.noop;
  53. _this._tapComplete = observerOrNext.complete || noop_1.noop;
  54. }
  55. return _this;
  56. }
  57. TapSubscriber.prototype._next = function (value) {
  58. try {
  59. this._tapNext.call(this._context, value);
  60. }
  61. catch (err) {
  62. this.destination.error(err);
  63. return;
  64. }
  65. this.destination.next(value);
  66. };
  67. TapSubscriber.prototype._error = function (err) {
  68. try {
  69. this._tapError.call(this._context, err);
  70. }
  71. catch (err) {
  72. this.destination.error(err);
  73. return;
  74. }
  75. this.destination.error(err);
  76. };
  77. TapSubscriber.prototype._complete = function () {
  78. try {
  79. this._tapComplete.call(this._context);
  80. }
  81. catch (err) {
  82. this.destination.error(err);
  83. return;
  84. }
  85. return this.destination.complete();
  86. };
  87. return TapSubscriber;
  88. }(Subscriber_1.Subscriber));
  89. //# sourceMappingURL=tap.js.map