asBehaviorSubject

asBehaviorSubject
(
TObservable
)
(
auto ref TObservable observable
)

Examples

1 import rx;
2 
3 auto num1 = new BehaviorSubject!int;
4 auto num2 = new BehaviorSubject!int;
5 
6 BehaviorSubject!int sum = combineLatest!((l, r) => l + r)(num1, num2).asBehaviorSubject();
7 
8 assert(sum.value == 0);
9 num1.value = 10;
10 assert(sum.value == 10);
11 num2.value = 20;
12 assert(sum.value == 30);