rxjs: switchMap and switchMapTo

 https://stackoverflow.com/questions/39108549/switchmapto-creates-observable-before-subscription

It is calling early because you are calling the function when you are building the stream.


switchMap takes a function which gets invoked when a new value comes from up stream. The result of that function is subscribed to as a new stream.


switchMapTo takes an Observable which is subscribed to for every value that comes from up stream. You are creating the Observable by invoking getTestStartTime$().


Use switchMap when the output depends on the value coming from upstream, and use switchMapTo when the actual upstream value is irrelevant and is only used as a signal for subscription.


Không có nhận xét nào:

filebrowserBrowseUrl and external file browser/uploader

 https://ckeditor.com/old/forums/CKEditor-3.x/filebrowserBrowseUrl-and-external-file-browseruploader Thanks for your replies, it actually wo...