| 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; |
| 7 |
return extendStatics(d, b); |
| 8 |
}; |
| 9 |
return function (d, b) { |
| 10 |
if (typeof b !== "function" && b !== null) |
| 11 |
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); |
| 12 |
extendStatics(d, b); |
| 13 |
function __() { this.constructor = d; } |
| 14 |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
| 15 |
}; |
| 16 |
})(); |
| 17 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 18 |
exports.OperatorSubscriber = exports.createOperatorSubscriber = void 0; |
| 19 |
var Subscriber_1 = require("../Subscriber"); |
| 20 |
function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) { |
| 21 |
return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize); |
| 22 |
} |
| 23 |
exports.createOperatorSubscriber = createOperatorSubscriber; |
| 24 |
var OperatorSubscriber = (function (_super) { |
| 25 |
__extends(OperatorSubscriber, _super); |
| 26 |
function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) { |
| 27 |
var _this = _super.call(this, destination) || this; |
| 28 |
_this.onFinalize = onFinalize; |
| 29 |
_this.shouldUnsubscribe = shouldUnsubscribe; |
| 30 |
_this._next = onNext |
| 31 |
? function (value) { |
| 32 |
try { |
| 33 |
onNext(value); |
| 34 |
} |
| 35 |
catch (err) { |
| 36 |
destination.error(err); |
| 37 |
} |
| 38 |
} |
| 39 |
: _super.prototype._next; |
| 40 |
_this._error = onError |
| 41 |
? function (err) { |
| 42 |
try { |
| 43 |
onError(err); |
| 44 |
} |
| 45 |
catch (err) { |
| 46 |
destination.error(err); |
| 47 |
} |
| 48 |
finally { |
| 49 |
this.unsubscribe(); |
| 50 |
} |
| 51 |
} |
| 52 |
: _super.prototype._error; |
| 53 |
_this._complete = onComplete |
| 54 |
? function () { |
| 55 |
try { |
| 56 |
onComplete(); |
| 57 |
} |
| 58 |
catch (err) { |
| 59 |
destination.error(err); |
| 60 |
} |
| 61 |
finally { |
| 62 |
this.unsubscribe(); |
| 63 |
} |
| 64 |
} |
| 65 |
: _super.prototype._complete; |
| 66 |
return _this; |
| 67 |
} |
| 68 |
OperatorSubscriber.prototype.unsubscribe = function () { |
| 69 |
var _a; |
| 70 |
if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { |
| 71 |
var closed_1 = this.closed; |
| 72 |
_super.prototype.unsubscribe.call(this); |
| 73 |
!closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this)); |
| 74 |
} |
| 75 |
}; |
| 76 |
return OperatorSubscriber; |
| 77 |
}(Subscriber_1.Subscriber)); |
| 78 |
exports.OperatorSubscriber = OperatorSubscriber; |
| 79 |
//# sourceMappingURL=OperatorSubscriber.js.map |