| /** 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 |