skipUntil.js 1.8 KB

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