skipUntil.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_InnerSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  2. import * as tslib_1 from "tslib";
  3. import { OuterSubscriber } from '../OuterSubscriber';
  4. import { InnerSubscriber } from '../InnerSubscriber';
  5. import { subscribeToResult } from '../util/subscribeToResult';
  6. export function skipUntil(notifier) {
  7. return function (source) { return source.lift(new SkipUntilOperator(notifier)); };
  8. }
  9. var SkipUntilOperator = /*@__PURE__*/ (function () {
  10. function SkipUntilOperator(notifier) {
  11. this.notifier = notifier;
  12. }
  13. SkipUntilOperator.prototype.call = function (destination, source) {
  14. return source.subscribe(new SkipUntilSubscriber(destination, this.notifier));
  15. };
  16. return SkipUntilOperator;
  17. }());
  18. var SkipUntilSubscriber = /*@__PURE__*/ (function (_super) {
  19. tslib_1.__extends(SkipUntilSubscriber, _super);
  20. function SkipUntilSubscriber(destination, notifier) {
  21. var _this = _super.call(this, destination) || this;
  22. _this.hasValue = false;
  23. var innerSubscriber = new InnerSubscriber(_this, undefined, undefined);
  24. _this.add(innerSubscriber);
  25. _this.innerSubscription = innerSubscriber;
  26. var innerSubscription = subscribeToResult(_this, notifier, undefined, undefined, innerSubscriber);
  27. if (innerSubscription !== innerSubscriber) {
  28. _this.add(innerSubscription);
  29. _this.innerSubscription = innerSubscription;
  30. }
  31. return _this;
  32. }
  33. SkipUntilSubscriber.prototype._next = function (value) {
  34. if (this.hasValue) {
  35. _super.prototype._next.call(this, value);
  36. }
  37. };
  38. SkipUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  39. this.hasValue = true;
  40. if (this.innerSubscription) {
  41. this.innerSubscription.unsubscribe();
  42. }
  43. };
  44. SkipUntilSubscriber.prototype.notifyComplete = function () {
  45. };
  46. return SkipUntilSubscriber;
  47. }(OuterSubscriber));
  48. //# sourceMappingURL=skipUntil.js.map