1 /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { OuterSubscriber } from '../OuterSubscriber';
4 import { subscribeToResult } from '../util/subscribeToResult';
5 export function takeUntil(notifier) {
6 return function (source) { return source.lift(new TakeUntilOperator(notifier)); };
8 var TakeUntilOperator = /*@__PURE__*/ (function () {
9 function TakeUntilOperator(notifier) {
10 this.notifier = notifier;
12 TakeUntilOperator.prototype.call = function (subscriber, source) {
13 var takeUntilSubscriber = new TakeUntilSubscriber(subscriber);
14 var notifierSubscription = subscribeToResult(takeUntilSubscriber, this.notifier);
15 if (notifierSubscription && !takeUntilSubscriber.seenValue) {
16 takeUntilSubscriber.add(notifierSubscription);
17 return source.subscribe(takeUntilSubscriber);
19 return takeUntilSubscriber;
21 return TakeUntilOperator;
23 var TakeUntilSubscriber = /*@__PURE__*/ (function (_super) {
24 tslib_1.__extends(TakeUntilSubscriber, _super);
25 function TakeUntilSubscriber(destination) {
26 var _this = _super.call(this, destination) || this;
27 _this.seenValue = false;
30 TakeUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
31 this.seenValue = true;
34 TakeUntilSubscriber.prototype.notifyComplete = function () {
36 return TakeUntilSubscriber;
38 //# sourceMappingURL=takeUntil.js.map