a zip code crypto-currency system good for red ONLY

skipUntil.js 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /** PURE_IMPORTS_START .._OuterSubscriber,.._util_subscribeToResult PURE_IMPORTS_END */
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b)
  4. if (b.hasOwnProperty(p))
  5. d[p] = b[p];
  6. function __() { this.constructor = d; }
  7. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8. };
  9. import { OuterSubscriber } from '../OuterSubscriber';
  10. import { subscribeToResult } from '../util/subscribeToResult';
  11. /**
  12. * Returns an Observable that skips items emitted by the source Observable until a second Observable emits an item.
  13. *
  14. * <img src="./img/skipUntil.png" width="100%">
  15. *
  16. * @param {Observable} notifier - The second Observable that has to emit an item before the source Observable's elements begin to
  17. * be mirrored by the resulting Observable.
  18. * @return {Observable<T>} An Observable that skips items from the source Observable until the second Observable emits
  19. * an item, then emits the remaining items.
  20. * @method skipUntil
  21. * @owner Observable
  22. */
  23. export function skipUntil(notifier) {
  24. return function (source) { return source.lift(new SkipUntilOperator(notifier)); };
  25. }
  26. var SkipUntilOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
  27. function SkipUntilOperator(notifier) {
  28. this.notifier = notifier;
  29. }
  30. SkipUntilOperator.prototype.call = function (subscriber, source) {
  31. return source.subscribe(new SkipUntilSubscriber(subscriber, this.notifier));
  32. };
  33. return SkipUntilOperator;
  34. }());
  35. /**
  36. * We need this JSDoc comment for affecting ESDoc.
  37. * @ignore
  38. * @extends {Ignored}
  39. */
  40. var SkipUntilSubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  41. __extends(SkipUntilSubscriber, _super);
  42. function SkipUntilSubscriber(destination, notifier) {
  43. _super.call(this, destination);
  44. this.hasValue = false;
  45. this.isInnerStopped = false;
  46. this.add(subscribeToResult(this, notifier));
  47. }
  48. SkipUntilSubscriber.prototype._next = function (value) {
  49. if (this.hasValue) {
  50. _super.prototype._next.call(this, value);
  51. }
  52. };
  53. SkipUntilSubscriber.prototype._complete = function () {
  54. if (this.isInnerStopped) {
  55. _super.prototype._complete.call(this);
  56. }
  57. else {
  58. this.unsubscribe();
  59. }
  60. };
  61. SkipUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  62. this.hasValue = true;
  63. };
  64. SkipUntilSubscriber.prototype.notifyComplete = function () {
  65. this.isInnerStopped = true;
  66. if (this.isStopped) {
  67. _super.prototype._complete.call(this);
  68. }
  69. };
  70. return SkipUntilSubscriber;
  71. }(OuterSubscriber));
  72. //# sourceMappingURL=skipUntil.js.map