takeUntil.js
1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/** 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