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);
9 return function (d, b) {
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 Object.defineProperty(exports, "__esModule", { value: true });
16 var Subject_1 = require("./Subject");
17 var ObjectUnsubscribedError_1 = require("./util/ObjectUnsubscribedError");
18 var BehaviorSubject = (function (_super) {
19 __extends(BehaviorSubject, _super);
20 function BehaviorSubject(_value) {
21 var _this = _super.call(this) || this;
22 _this._value = _value;
25 Object.defineProperty(BehaviorSubject.prototype, "value", {
27 return this.getValue();
32 BehaviorSubject.prototype._subscribe = function (subscriber) {
33 var subscription = _super.prototype._subscribe.call(this, subscriber);
34 if (subscription && !subscription.closed) {
35 subscriber.next(this._value);
39 BehaviorSubject.prototype.getValue = function () {
41 throw this.thrownError;
43 else if (this.closed) {
44 throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
50 BehaviorSubject.prototype.next = function (value) {
51 _super.prototype.next.call(this, this._value = value);
53 return BehaviorSubject;
54 }(Subject_1.Subject));
55 exports.BehaviorSubject = BehaviorSubject;
56 //# sourceMappingURL=BehaviorSubject.js.map