source: trip-planner-front/node_modules/rxjs/_esm5/internal/operators/tap.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/** PURE_IMPORTS_START tslib,_Subscriber,_util_noop,_util_isFunction PURE_IMPORTS_END */
2import * as tslib_1 from "tslib";
3import { Subscriber } from '../Subscriber';
4import { noop } from '../util/noop';
5import { isFunction } from '../util/isFunction';
6export function tap(nextOrObserver, error, complete) {
7 return function tapOperatorFunction(source) {
8 return source.lift(new DoOperator(nextOrObserver, error, complete));
9 };
10}
11var DoOperator = /*@__PURE__*/ (function () {
12 function DoOperator(nextOrObserver, error, complete) {
13 this.nextOrObserver = nextOrObserver;
14 this.error = error;
15 this.complete = complete;
16 }
17 DoOperator.prototype.call = function (subscriber, source) {
18 return source.subscribe(new TapSubscriber(subscriber, this.nextOrObserver, this.error, this.complete));
19 };
20 return DoOperator;
21}());
22var TapSubscriber = /*@__PURE__*/ (function (_super) {
23 tslib_1.__extends(TapSubscriber, _super);
24 function TapSubscriber(destination, observerOrNext, error, complete) {
25 var _this = _super.call(this, destination) || this;
26 _this._tapNext = noop;
27 _this._tapError = noop;
28 _this._tapComplete = noop;
29 _this._tapError = error || noop;
30 _this._tapComplete = complete || noop;
31 if (isFunction(observerOrNext)) {
32 _this._context = _this;
33 _this._tapNext = observerOrNext;
34 }
35 else if (observerOrNext) {
36 _this._context = observerOrNext;
37 _this._tapNext = observerOrNext.next || noop;
38 _this._tapError = observerOrNext.error || noop;
39 _this._tapComplete = observerOrNext.complete || noop;
40 }
41 return _this;
42 }
43 TapSubscriber.prototype._next = function (value) {
44 try {
45 this._tapNext.call(this._context, value);
46 }
47 catch (err) {
48 this.destination.error(err);
49 return;
50 }
51 this.destination.next(value);
52 };
53 TapSubscriber.prototype._error = function (err) {
54 try {
55 this._tapError.call(this._context, err);
56 }
57 catch (err) {
58 this.destination.error(err);
59 return;
60 }
61 this.destination.error(err);
62 };
63 TapSubscriber.prototype._complete = function () {
64 try {
65 this._tapComplete.call(this._context);
66 }
67 catch (err) {
68 this.destination.error(err);
69 return;
70 }
71 return this.destination.complete();
72 };
73 return TapSubscriber;
74}(Subscriber));
75//# sourceMappingURL=tap.js.map
Note: See TracBrowser for help on using the repository browser.