I have following code:
console.log('start');
//emit value every second
const message = Rx.Observable.interval(1000);
//emit value as soon as subscribed
const trueObs = () => Rx.Observable.of(true);
// start emitting delayed values as soon as trueObs emits
const delayWhenExample = message.delayWhen(trueObs);
//log values start logging after one second
//ex. output: 0...1...2...3
const subscribe = delayWhenExample.subscribe(val => console.log(val));
<script src="https://npmcdn.com/@reactivex/rxjs@5.0.0-beta.8/dist/global/Rx.umd.js"></script>
Why Rx.Observable.of(true)
starts to emit value without subscribe
the observable?
I understand the concept to RxJS as lazy evaluation, it does not emit values, until I am asking it.