Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

onErrorResumeNext.js 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. }
  9. return function (d, b) {
  10. extendStatics(d, b);
  11. function __() { this.constructor = d; }
  12. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13. };
  14. })();
  15. Object.defineProperty(exports, "__esModule", { value: true });
  16. var from_1 = require("../observable/from");
  17. var isArray_1 = require("../util/isArray");
  18. var OuterSubscriber_1 = require("../OuterSubscriber");
  19. var InnerSubscriber_1 = require("../InnerSubscriber");
  20. var subscribeToResult_1 = require("../util/subscribeToResult");
  21. function onErrorResumeNext() {
  22. var nextSources = [];
  23. for (var _i = 0; _i < arguments.length; _i++) {
  24. nextSources[_i] = arguments[_i];
  25. }
  26. if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) {
  27. nextSources = nextSources[0];
  28. }
  29. return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); };
  30. }
  31. exports.onErrorResumeNext = onErrorResumeNext;
  32. function onErrorResumeNextStatic() {
  33. var nextSources = [];
  34. for (var _i = 0; _i < arguments.length; _i++) {
  35. nextSources[_i] = arguments[_i];
  36. }
  37. var source = null;
  38. if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) {
  39. nextSources = nextSources[0];
  40. }
  41. source = nextSources.shift();
  42. return from_1.from(source, null).lift(new OnErrorResumeNextOperator(nextSources));
  43. }
  44. exports.onErrorResumeNextStatic = onErrorResumeNextStatic;
  45. var OnErrorResumeNextOperator = (function () {
  46. function OnErrorResumeNextOperator(nextSources) {
  47. this.nextSources = nextSources;
  48. }
  49. OnErrorResumeNextOperator.prototype.call = function (subscriber, source) {
  50. return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
  51. };
  52. return OnErrorResumeNextOperator;
  53. }());
  54. var OnErrorResumeNextSubscriber = (function (_super) {
  55. __extends(OnErrorResumeNextSubscriber, _super);
  56. function OnErrorResumeNextSubscriber(destination, nextSources) {
  57. var _this = _super.call(this, destination) || this;
  58. _this.destination = destination;
  59. _this.nextSources = nextSources;
  60. return _this;
  61. }
  62. OnErrorResumeNextSubscriber.prototype.notifyError = function (error, innerSub) {
  63. this.subscribeToNextSource();
  64. };
  65. OnErrorResumeNextSubscriber.prototype.notifyComplete = function (innerSub) {
  66. this.subscribeToNextSource();
  67. };
  68. OnErrorResumeNextSubscriber.prototype._error = function (err) {
  69. this.subscribeToNextSource();
  70. this.unsubscribe();
  71. };
  72. OnErrorResumeNextSubscriber.prototype._complete = function () {
  73. this.subscribeToNextSource();
  74. this.unsubscribe();
  75. };
  76. OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
  77. var next = this.nextSources.shift();
  78. if (!!next) {
  79. var innerSubscriber = new InnerSubscriber_1.InnerSubscriber(this, undefined, undefined);
  80. var destination = this.destination;
  81. destination.add(innerSubscriber);
  82. subscribeToResult_1.subscribeToResult(this, next, undefined, undefined, innerSubscriber);
  83. }
  84. else {
  85. this.destination.complete();
  86. }
  87. };
  88. return OnErrorResumeNextSubscriber;
  89. }(OuterSubscriber_1.OuterSubscriber));
  90. //# sourceMappingURL=onErrorResumeNext.js.map