| 1 |
import { Subject } from './Subject'; |
| 2 |
export class BehaviorSubject extends Subject { |
| 3 |
constructor(_value) { |
| 4 |
super(); |
| 5 |
this._value = _value; |
| 6 |
} |
| 7 |
get value() { |
| 8 |
return this.getValue(); |
| 9 |
} |
| 10 |
_subscribe(subscriber) { |
| 11 |
const subscription = super._subscribe(subscriber); |
| 12 |
!subscription.closed && subscriber.next(this._value); |
| 13 |
return subscription; |
| 14 |
} |
| 15 |
getValue() { |
| 16 |
const { hasError, thrownError, _value } = this; |
| 17 |
if (hasError) { |
| 18 |
throw thrownError; |
| 19 |
} |
| 20 |
this._throwIfClosed(); |
| 21 |
return _value; |
| 22 |
} |
| 23 |
next(value) { |
| 24 |
super.next((this._value = value)); |
| 25 |
} |
| 26 |
} |
| 27 |
//# sourceMappingURL=BehaviorSubject.js.map |