Debian Codegraph @

node/rxjs/dist/cjs/internal/operators/tap.js

raw
1 "use strict";
2 Object.defineProperty(exports, "__esModule", { value: true });
3 exports.tap = void 0;
4 var isFunction_1 = require("../util/isFunction");
5 var lift_1 = require("../util/lift");
6 var OperatorSubscriber_1 = require("./OperatorSubscriber");
7 var identity_1 = require("../util/identity");
8 function tap(observerOrNext, error, complete) {
9 var tapObserver = isFunction_1.isFunction(observerOrNext) || error || complete
10 ?
11 { next: observerOrNext, error: error, complete: complete }
12 : observerOrNext;
13 return tapObserver
14 ? lift_1.operate(function (source, subscriber) {
15 var _a;
16 (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
17 var isUnsub = true;
18 source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, function (value) {
19 var _a;
20 (_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
21 subscriber.next(value);
22 }, function () {
23 var _a;
24 isUnsub = false;
25 (_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
26 subscriber.complete();
27 }, function (err) {
28 var _a;
29 isUnsub = false;
30 (_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);
31 subscriber.error(err);
32 }, function () {
33 var _a, _b;
34 if (isUnsub) {
35 (_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
36 }
37 (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
38 }));
39 })
40 :
41 identity_1.identity;
42 }
43 exports.tap = tap;
44 //# sourceMappingURL=tap.js.map