ignoreElements.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. var noop_1 = require('../util/noop');
  9. /**
  10. * Ignores all items emitted by the source Observable and only passes calls of `complete` or `error`.
  11. *
  12. * <img src="./img/ignoreElements.png" width="100%">
  13. *
  14. * @return {Observable} An empty Observable that only calls `complete`
  15. * or `error`, based on which one is called by the source Observable.
  16. * @method ignoreElements
  17. * @owner Observable
  18. */
  19. function ignoreElements() {
  20. return function ignoreElementsOperatorFunction(source) {
  21. return source.lift(new IgnoreElementsOperator());
  22. };
  23. }
  24. exports.ignoreElements = ignoreElements;
  25. var IgnoreElementsOperator = (function () {
  26. function IgnoreElementsOperator() {
  27. }
  28. IgnoreElementsOperator.prototype.call = function (subscriber, source) {
  29. return source.subscribe(new IgnoreElementsSubscriber(subscriber));
  30. };
  31. return IgnoreElementsOperator;
  32. }());
  33. /**
  34. * We need this JSDoc comment for affecting ESDoc.
  35. * @ignore
  36. * @extends {Ignored}
  37. */
  38. var IgnoreElementsSubscriber = (function (_super) {
  39. __extends(IgnoreElementsSubscriber, _super);
  40. function IgnoreElementsSubscriber() {
  41. _super.apply(this, arguments);
  42. }
  43. IgnoreElementsSubscriber.prototype._next = function (unused) {
  44. noop_1.noop();
  45. };
  46. return IgnoreElementsSubscriber;
  47. }(Subscriber_1.Subscriber));
  48. //# sourceMappingURL=ignoreElements.js.map