In RxJS how would I change the interval setting after creation?
So far I have this, but it doesn't work
var observable = Rx.Observable.interval(500)
.map(function (data) { return "Hello World " + data; });
observable.subscribe(console.log);
setTimeout(function () {
observable.interval(3000);
}, 3000);
It says "TypeError: observable.interval is not a function at sixage.js:10:14"
Edit:
This was the final product after using the accepted answer.
var intervalUpdateS = new Rx.Subject();
var observable = intervalUpdateS.startWith(500).flatMapLatest(function(intvl){
return Rx.Observable.interval(intvl);
})
.map (function (data) { return "Hello World " + data; });
observable.subscribe(function (msg) {
console.log(msg);
});
setTimeout(function () {
intervalUpdateS.onNext(3000)
}, 3000);