ignoreElements.js 1.7KB

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