1
搜索小時後......大多數的例子是這樣的...rxjs takeuntil,檢查直至觀察到的源是有效
var source = Rx.Observable.timer(0, 1000)
.takeUntil(Rx.Observable.timer(5000));
var subscription = source.subscribe(
function (x) { console.log('Next: ' + x); },
function (err) { console.log('Error: ' + err); },
function() { console.log('Completed'); })
結果
Next: 0
Next: 1
Next: 2
Next: 3
Next: 4
Completed
但是,我婉知道的是有可能從源值檢查不是另一個可觀察的對象..這樣的事情..
var source = Rx.Observable.timer(0, 1000)
.takeUntil((result) => result == 5);