wishthis/node_modules/rxjs/_esm5/internal/operators/takeUntil.js
2022-05-29 11:24:36 +02:00

37 lines
1.5 KiB
JavaScript

/** PURE_IMPORTS_START tslib,_innerSubscribe PURE_IMPORTS_END */
import * as tslib_1 from "tslib";
import { innerSubscribe, SimpleInnerSubscriber, SimpleOuterSubscriber } from '../innerSubscribe';
export function takeUntil(notifier) {
return function (source) { return source.lift(new TakeUntilOperator(notifier)); };
}
var TakeUntilOperator = /*@__PURE__*/ (function () {
function TakeUntilOperator(notifier) {
this.notifier = notifier;
}
TakeUntilOperator.prototype.call = function (subscriber, source) {
var takeUntilSubscriber = new TakeUntilSubscriber(subscriber);
var notifierSubscription = innerSubscribe(this.notifier, new SimpleInnerSubscriber(takeUntilSubscriber));
if (notifierSubscription && !takeUntilSubscriber.seenValue) {
takeUntilSubscriber.add(notifierSubscription);
return source.subscribe(takeUntilSubscriber);
}
return takeUntilSubscriber;
};
return TakeUntilOperator;
}());
var TakeUntilSubscriber = /*@__PURE__*/ (function (_super) {
tslib_1.__extends(TakeUntilSubscriber, _super);
function TakeUntilSubscriber(destination) {
var _this = _super.call(this, destination) || this;
_this.seenValue = false;
return _this;
}
TakeUntilSubscriber.prototype.notifyNext = function () {
this.seenValue = true;
this.complete();
};
TakeUntilSubscriber.prototype.notifyComplete = function () {
};
return TakeUntilSubscriber;
}(SimpleOuterSubscriber));
//# sourceMappingURL=takeUntil.js.map