Reputation: 5065
Rx.Observable.returnValue has scheduler as second parameter. I thought to return value after some time it should be like this
Rx.Observable.returnValue(value, Rx.Scheduler.timeout.scheduleRelative(5000));
But second parameter should be just Rx.Scheduler.timeout
and it makes no sense to me because all schedulers currentThread, immediate or timeout returns value immediately.
So I have two questions:
returnValue
?Upvotes: 0
Views: 1745
Reputation: 18125
Although I'd need more time to figure out why the scheduler isn't working for you, you can use the delay
operator to delay notifications by a certain number of milliseconds.
Rx.Observable.returnValue(value).delay(5000);
Typically you won't need Schedulers
in RxJS unless you need very advanced control over when and how notifications are sent. It is more common to need Schedulers
in Rx.NET.
I believe many schedulers are being removed for the lite version of RxJS, simply because they are not typically needed.
Upvotes: 1