onErrorResumeNext.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import { Observable } from '../Observable';
  2. import { argsOrArgArray } from '../util/argsOrArgArray';
  3. import { OperatorSubscriber } from '../operators/OperatorSubscriber';
  4. import { noop } from '../util/noop';
  5. import { innerFrom } from './innerFrom';
  6. export function onErrorResumeNext(...sources) {
  7. const nextSources = argsOrArgArray(sources);
  8. return new Observable((subscriber) => {
  9. let sourceIndex = 0;
  10. const subscribeNext = () => {
  11. if (sourceIndex < nextSources.length) {
  12. let nextSource;
  13. try {
  14. nextSource = innerFrom(nextSources[sourceIndex++]);
  15. }
  16. catch (err) {
  17. subscribeNext();
  18. return;
  19. }
  20. const innerSubscriber = new OperatorSubscriber(subscriber, undefined, noop, noop);
  21. nextSource.subscribe(innerSubscriber);
  22. innerSubscriber.add(subscribeNext);
  23. }
  24. else {
  25. subscriber.complete();
  26. }
  27. };
  28. subscribeNext();
  29. });
  30. }
  31. //# sourceMappingURL=onErrorResumeNext.js.map