| 1 |
import { __extends } from "tslib"; |
| 2 |
import { Subject } from './Subject'; |
| 3 |
var BehaviorSubject = (function (_super) { |
| 4 |
__extends(BehaviorSubject, _super); |
| 5 |
function BehaviorSubject(_value) { |
| 6 |
var _this = _super.call(this) || this; |
| 7 |
_this._value = _value; |
| 8 |
return _this; |
| 9 |
} |
| 10 |
Object.defineProperty(BehaviorSubject.prototype, "value", { |
| 11 |
get: function () { |
| 12 |
return this.getValue(); |
| 13 |
}, |
| 14 |
enumerable: false, |
| 15 |
configurable: true |
| 16 |
}); |
| 17 |
BehaviorSubject.prototype._subscribe = function (subscriber) { |
| 18 |
var subscription = _super.prototype._subscribe.call(this, subscriber); |
| 19 |
!subscription.closed && subscriber.next(this._value); |
| 20 |
return subscription; |
| 21 |
}; |
| 22 |
BehaviorSubject.prototype.getValue = function () { |
| 23 |
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value; |
| 24 |
if (hasError) { |
| 25 |
throw thrownError; |
| 26 |
} |
| 27 |
this._throwIfClosed(); |
| 28 |
return _value; |
| 29 |
}; |
| 30 |
BehaviorSubject.prototype.next = function (value) { |
| 31 |
_super.prototype.next.call(this, (this._value = value)); |
| 32 |
}; |
| 33 |
return BehaviorSubject; |
| 34 |
}(Subject)); |
| 35 |
export { BehaviorSubject }; |
| 36 |
//# sourceMappingURL=BehaviorSubject.js.map |