2022-01-21 08:28:41 +00:00
|
|
|
"use strict";
|
|
|
|
var __extends = (this && this.__extends) || (function () {
|
|
|
|
var extendStatics = function (d, b) {
|
|
|
|
extendStatics = Object.setPrototypeOf ||
|
|
|
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
2022-06-08 10:36:39 +00:00
|
|
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
2022-01-21 08:28:41 +00:00
|
|
|
return extendStatics(d, b);
|
2022-06-08 10:36:39 +00:00
|
|
|
};
|
2022-01-21 08:28:41 +00:00
|
|
|
return function (d, b) {
|
2022-06-08 10:36:39 +00:00
|
|
|
if (typeof b !== "function" && b !== null)
|
|
|
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2022-01-21 08:28:41 +00:00
|
|
|
extendStatics(d, b);
|
|
|
|
function __() { this.constructor = d; }
|
|
|
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
|
|
};
|
|
|
|
})();
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2022-06-08 10:36:39 +00:00
|
|
|
exports.BehaviorSubject = void 0;
|
2022-01-21 08:28:41 +00:00
|
|
|
var Subject_1 = require("./Subject");
|
|
|
|
var BehaviorSubject = (function (_super) {
|
|
|
|
__extends(BehaviorSubject, _super);
|
|
|
|
function BehaviorSubject(_value) {
|
|
|
|
var _this = _super.call(this) || this;
|
|
|
|
_this._value = _value;
|
|
|
|
return _this;
|
|
|
|
}
|
|
|
|
Object.defineProperty(BehaviorSubject.prototype, "value", {
|
|
|
|
get: function () {
|
|
|
|
return this.getValue();
|
|
|
|
},
|
2022-06-08 10:36:39 +00:00
|
|
|
enumerable: false,
|
2022-01-21 08:28:41 +00:00
|
|
|
configurable: true
|
|
|
|
});
|
|
|
|
BehaviorSubject.prototype._subscribe = function (subscriber) {
|
|
|
|
var subscription = _super.prototype._subscribe.call(this, subscriber);
|
2022-06-08 10:36:39 +00:00
|
|
|
!subscription.closed && subscriber.next(this._value);
|
2022-01-21 08:28:41 +00:00
|
|
|
return subscription;
|
|
|
|
};
|
|
|
|
BehaviorSubject.prototype.getValue = function () {
|
2022-06-08 10:36:39 +00:00
|
|
|
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;
|
|
|
|
if (hasError) {
|
|
|
|
throw thrownError;
|
2022-01-21 08:28:41 +00:00
|
|
|
}
|
2022-06-08 10:36:39 +00:00
|
|
|
this._throwIfClosed();
|
|
|
|
return _value;
|
2022-01-21 08:28:41 +00:00
|
|
|
};
|
|
|
|
BehaviorSubject.prototype.next = function (value) {
|
2022-06-08 10:36:39 +00:00
|
|
|
_super.prototype.next.call(this, (this._value = value));
|
2022-01-21 08:28:41 +00:00
|
|
|
};
|
|
|
|
return BehaviorSubject;
|
|
|
|
}(Subject_1.Subject));
|
|
|
|
exports.BehaviorSubject = BehaviorSubject;
|
|
|
|
//# sourceMappingURL=BehaviorSubject.js.map
|