rxjs
Version:
Reactive Extensions for modern JavaScript
55 lines • 1.79 kB
JavaScript
import { __extends } from "tslib";
import { Subscriber } from '../Subscriber';
var OperatorSubscriber = (function (_super) {
__extends(OperatorSubscriber, _super);
function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
var _this = _super.call(this, destination) || this;
_this.onFinalize = onFinalize;
_this._next = onNext
? function (value) {
try {
onNext(value);
}
catch (err) {
destination.error(err);
}
}
: _super.prototype._next;
_this._error = onError
? function (err) {
try {
onError(err);
}
catch (err) {
destination.error(err);
}
finally {
this.unsubscribe();
}
}
: _super.prototype._error;
_this._complete = onComplete
? function () {
try {
onComplete();
}
catch (err) {
destination.error(err);
}
finally {
this.unsubscribe();
}
}
: _super.prototype._complete;
return _this;
}
OperatorSubscriber.prototype.unsubscribe = function () {
var _a;
var closed = this.closed;
_super.prototype.unsubscribe.call(this);
!closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
};
return OperatorSubscriber;
}(Subscriber));
export { OperatorSubscriber };
//# sourceMappingURL=OperatorSubscriber.js.map