onErrorResumeNext.js 1.1 KB

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var Observable_1 = require("../Observable");
  4. var from_1 = require("./from");
  5. var isArray_1 = require("../util/isArray");
  6. var empty_1 = require("./empty");
  7. function onErrorResumeNext() {
  8. var sources = [];
  9. for (var _i = 0; _i < arguments.length; _i++) {
  10. sources[_i] = arguments[_i];
  11. }
  12. if (sources.length === 0) {
  13. return empty_1.EMPTY;
  14. }
  15. var first = sources[0], remainder = sources.slice(1);
  16. if (sources.length === 1 && isArray_1.isArray(first)) {
  17. return onErrorResumeNext.apply(void 0, first);
  18. }
  19. return new Observable_1.Observable(function (subscriber) {
  20. var subNext = function () { return subscriber.add(onErrorResumeNext.apply(void 0, remainder).subscribe(subscriber)); };
  21. return from_1.from(first).subscribe({
  22. next: function (value) { subscriber.next(value); },
  23. error: subNext,
  24. complete: subNext,
  25. });
  26. });
  27. }
  28. exports.onErrorResumeNext = onErrorResumeNext;
  29. //# sourceMappingURL=onErrorResumeNext.js.map