isEmpty.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /** PURE_IMPORTS_START .._Subscriber 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 { Subscriber } from '../Subscriber';
  10. export function isEmpty() {
  11. return function (source) { return source.lift(new IsEmptyOperator()); };
  12. }
  13. var IsEmptyOperator = /*@__PURE__*/ (/*@__PURE__*/ function () {
  14. function IsEmptyOperator() {
  15. }
  16. IsEmptyOperator.prototype.call = function (observer, source) {
  17. return source.subscribe(new IsEmptySubscriber(observer));
  18. };
  19. return IsEmptyOperator;
  20. }());
  21. /**
  22. * We need this JSDoc comment for affecting ESDoc.
  23. * @ignore
  24. * @extends {Ignored}
  25. */
  26. var IsEmptySubscriber = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  27. __extends(IsEmptySubscriber, _super);
  28. function IsEmptySubscriber(destination) {
  29. _super.call(this, destination);
  30. }
  31. IsEmptySubscriber.prototype.notifyComplete = function (isEmpty) {
  32. var destination = this.destination;
  33. destination.next(isEmpty);
  34. destination.complete();
  35. };
  36. IsEmptySubscriber.prototype._next = function (value) {
  37. this.notifyComplete(false);
  38. };
  39. IsEmptySubscriber.prototype._complete = function () {
  40. this.notifyComplete(true);
  41. };
  42. return IsEmptySubscriber;
  43. }(Subscriber));
  44. //# sourceMappingURL=isEmpty.js.map