是否可以在已設置另一個超時後重置/增加Observable的超時?在下面的例子中的5超時應與9999超時被覆蓋,但是這並不工作:RxJS可觀察重置超時
var source = Rx.Observable
.return(42)
.delay(1000)
.timeout(5)
.timeout(9999); // this statement should override the previous set timeout of 5 MS, but actually it does not
var subscription = source.subscribe(
function (x) {
console.log('Next: ' + x);
},
function (err) {
console.log('Error: ' + err);
},
function() {
console.log('Completed');
});
是否有任何可能性,以覆蓋已經設置超時?
當您想要更改超時時,您可以重新訂閱嗎?然後,你可以在訂閱時間,如source.timeout(timeoutVariable).subscribe(....),以及desubscribeing - 當timeoutVariable改變時重新訂閱....實際上,有什麼辦法可以將這個改變事件放入一個流?編輯 - 喲,提交posible答案 – olivarra1