[RxJS] Throttling vs Debouncing

DebounceTime:code

It's like delay, but passes only the most recent value from each burst of emissions.blog

ThrottleTime:get

Lets a value pass, then ignores source values for the next duration milliseconds.requests

 

That's been said, debounce will get latest value, but throttle will not always get latest value.io

Therefore, the use case can be that:test

  when we trying to sending the request to the backend, we want to use 'debounce'.request

  When we tryint to get interval requests from the backend, we can use throttle, whichs means we don't always need timely data.im

 

相關文章
相關標籤/搜索