BehaviorSubject initial value not working with share()
问题 share() operator is applied to a BehaviorSubject. BehaviorSubject has initial value. Goal is to create a single shared subscribtion. But this shared subscribtion does not seem to work when BehaviorSubject has an initial value. Getting unexpected results. Code shown below: let subject = new Rx.BehaviorSubject(0); let published = subject .do(v => console.log("side effect")) .share(); published.subscribe((v) => console.log(v+" sub1")); published.subscribe((v) => console.log(v+" sub2")); subject