You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 20, 2018. It is now read-only.
<ahref="#rxbehaviorsubjectintialvalue">#</a> [Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/subjects/behaviorsubject.js#L30-L37"View in source")
54
+
<ahref="#rxbehaviorsubjectintialvalue">#</a> [Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/subjects/behaviorsubject.js#L27-L34"View in source")
54
55
55
56
Initializes a new instance of the `Rx.BehaviorSubject` class which creates a subject that caches its last value and starts with the specified value.
<ahref="#rxbehaviorsubjectprototypedispose">#</a> [Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/subjects/behaviorsubject.js#L97-L102"View in source")
96
+
<ahref="#rxbehaviorsubjectprototypedispose">#</a> [Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/subjects/behaviorsubject.js#L101-L106"View in source")
<ahref="#rxbehaviorsubjectprototypegetvalue">#</a> [Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/subjects/behaviorsubject.js#L44-L50"View in source")
140
+
141
+
Gets the current value or throws an exception.
142
+
Value is frozen after `onCompleted` is called.
143
+
After `onError` is called always throws the specified exception.
144
+
An exception is always thrown after `dispose` is called.
145
+
146
+
#### Returns
147
+
*(Mixed)*: The initial `value` passed to the constructor until `onNext` is called; after which, the last value passed to `onNext`.
148
+
149
+
#### Example
150
+
```js
151
+
var subject =newRx.BehaviorSubject(56);
152
+
153
+
console.log('Value is: '+subject.getValue());
154
+
155
+
// => Value is: 56
156
+
157
+
subject.onNext(42);
158
+
159
+
console.log('Value is: '+subject.getValue());
160
+
161
+
// => Value is: 42
162
+
163
+
subject.onCompleted();
164
+
165
+
subject.onNext(100);
166
+
167
+
console.log('Value is frozen: '+subject.getValue());
<ahref="#rxbehaviorsubjectprototypehasobservers">#</a> [Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/subjects/behaviorsubject.js#L44-L46"View in source")
189
+
<ahref="#rxbehaviorsubjectprototypehasobservers">#</a> [Ⓢ](https://github.com/Reactive-Extensions/RxJS/blob/master/src/core/subjects/behaviorsubject.js#L55"View in source")
139
190
140
191
Indicates whether the subject has observers subscribed to it.
0 commit comments