ignoreElements.js 976 B

123456789101112131415161718192021222324252627282930313233
  1. import { Subscriber } from '../Subscriber';
  2. import { noop } from '../util/noop';
  3. /**
  4. * Ignores all items emitted by the source Observable and only passes calls of `complete` or `error`.
  5. *
  6. * <img src="./img/ignoreElements.png" width="100%">
  7. *
  8. * @return {Observable} An empty Observable that only calls `complete`
  9. * or `error`, based on which one is called by the source Observable.
  10. * @method ignoreElements
  11. * @owner Observable
  12. */
  13. export function ignoreElements() {
  14. return function ignoreElementsOperatorFunction(source) {
  15. return source.lift(new IgnoreElementsOperator());
  16. };
  17. }
  18. class IgnoreElementsOperator {
  19. call(subscriber, source) {
  20. return source.subscribe(new IgnoreElementsSubscriber(subscriber));
  21. }
  22. }
  23. /**
  24. * We need this JSDoc comment for affecting ESDoc.
  25. * @ignore
  26. * @extends {Ignored}
  27. */
  28. class IgnoreElementsSubscriber extends Subscriber {
  29. _next(unused) {
  30. noop();
  31. }
  32. }
  33. //# sourceMappingURL=ignoreElements.js.map