isEmpty.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4. function __() { this.constructor = d; }
  5. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6. };
  7. var Subscriber_1 = require('../Subscriber');
  8. function isEmpty() {
  9. return function (source) { return source.lift(new IsEmptyOperator()); };
  10. }
  11. exports.isEmpty = isEmpty;
  12. var IsEmptyOperator = (function () {
  13. function IsEmptyOperator() {
  14. }
  15. IsEmptyOperator.prototype.call = function (observer, source) {
  16. return source.subscribe(new IsEmptySubscriber(observer));
  17. };
  18. return IsEmptyOperator;
  19. }());
  20. /**
  21. * We need this JSDoc comment for affecting ESDoc.
  22. * @ignore
  23. * @extends {Ignored}
  24. */
  25. var IsEmptySubscriber = (function (_super) {
  26. __extends(IsEmptySubscriber, _super);
  27. function IsEmptySubscriber(destination) {
  28. _super.call(this, destination);
  29. }
  30. IsEmptySubscriber.prototype.notifyComplete = function (isEmpty) {
  31. var destination = this.destination;
  32. destination.next(isEmpty);
  33. destination.complete();
  34. };
  35. IsEmptySubscriber.prototype._next = function (value) {
  36. this.notifyComplete(false);
  37. };
  38. IsEmptySubscriber.prototype._complete = function () {
  39. this.notifyComplete(true);
  40. };
  41. return IsEmptySubscriber;
  42. }(Subscriber_1.Subscriber));
  43. //# sourceMappingURL=isEmpty.js.map