onErrorResumeNext.js 1.0 KB

123456789101112131415161718192021222324252627
  1. /** PURE_IMPORTS_START _Observable,_from,_util_isArray,_empty PURE_IMPORTS_END */
  2. import { Observable } from '../Observable';
  3. import { from } from './from';
  4. import { isArray } from '../util/isArray';
  5. import { EMPTY } from './empty';
  6. export function onErrorResumeNext() {
  7. var sources = [];
  8. for (var _i = 0; _i < arguments.length; _i++) {
  9. sources[_i] = arguments[_i];
  10. }
  11. if (sources.length === 0) {
  12. return EMPTY;
  13. }
  14. var first = sources[0], remainder = sources.slice(1);
  15. if (sources.length === 1 && isArray(first)) {
  16. return onErrorResumeNext.apply(void 0, first);
  17. }
  18. return new Observable(function (subscriber) {
  19. var subNext = function () { return subscriber.add(onErrorResumeNext.apply(void 0, remainder).subscribe(subscriber)); };
  20. return from(first).subscribe({
  21. next: function (value) { subscriber.next(value); },
  22. error: subNext,
  23. complete: subNext,
  24. });
  25. });
  26. }
  27. //# sourceMappingURL=onErrorResumeNext.js.map