This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/rxjs/_esm5/internal/operators/tap.js
2019-08-11 20:48:02 +02:00

75 lines
2.6 KiB
JavaScript

/** PURE_IMPORTS_START tslib,_Subscriber,_util_noop,_util_isFunction PURE_IMPORTS_END */
import * as tslib_1 from "tslib";
import { Subscriber } from '../Subscriber';
import { noop } from '../util/noop';
import { isFunction } from '../util/isFunction';
export function tap(nextOrObserver, error, complete) {
return function tapOperatorFunction(source) {
return source.lift(new DoOperator(nextOrObserver, error, complete));
};
}
var DoOperator = /*@__PURE__*/ (function () {
function DoOperator(nextOrObserver, error, complete) {
this.nextOrObserver = nextOrObserver;
this.error = error;
this.complete = complete;
}
DoOperator.prototype.call = function (subscriber, source) {
return source.subscribe(new TapSubscriber(subscriber, this.nextOrObserver, this.error, this.complete));
};
return DoOperator;
}());
var TapSubscriber = /*@__PURE__*/ (function (_super) {
tslib_1.__extends(TapSubscriber, _super);
function TapSubscriber(destination, observerOrNext, error, complete) {
var _this = _super.call(this, destination) || this;
_this._tapNext = noop;
_this._tapError = noop;
_this._tapComplete = noop;
_this._tapError = error || noop;
_this._tapComplete = complete || noop;
if (isFunction(observerOrNext)) {
_this._context = _this;
_this._tapNext = observerOrNext;
}
else if (observerOrNext) {
_this._context = observerOrNext;
_this._tapNext = observerOrNext.next || noop;
_this._tapError = observerOrNext.error || noop;
_this._tapComplete = observerOrNext.complete || noop;
}
return _this;
}
TapSubscriber.prototype._next = function (value) {
try {
this._tapNext.call(this._context, value);
}
catch (err) {
this.destination.error(err);
return;
}
this.destination.next(value);
};
TapSubscriber.prototype._error = function (err) {
try {
this._tapError.call(this._context, err);
}
catch (err) {
this.destination.error(err);
return;
}
this.destination.error(err);
};
TapSubscriber.prototype._complete = function () {
try {
this._tapComplete.call(this._context);
}
catch (err) {
this.destination.error(err);
return;
}
return this.destination.complete();
};
return TapSubscriber;
}(Subscriber));
//# sourceMappingURL=tap.js.map