rxjs中审核和反跳之间的区别? [英] Difference between audit and debounce in rxjs?
问题描述
我正在阅读rxjs的官方文档,然后我意识到它们都在做完全相同的事情.
I am reading the offical documentaion of rxjs and then i realized they both are doing exactly same thing.
在我看来,它们两者似乎完全相似.
To me they both seems to exactly similar.
请有人指出它们之间的区别(如果有的话)
Please someone point out difference between them (if any)
推荐答案
我将根据它们的Time
版本来描述它们之间的区别,因为这是我对它们的最佳理解.
I'm going to describe the difference between them in terms of their Time
versions as that's how I understand them best.
auditTime
和debounceTime
都将在事件进入时首先启动计时器.两者都将等待给定的时间,然后才发出事件.不同之处在于,只要有新事件出现,debounceTime
就会重置计时器,而auditTime
不会出现. auditTime
将在给定的毫秒数后发出最近的事件,无论它是否仍在接收事件. debounceTime
将等待事件中的间隔.您说您已经阅读了文档,但只是仔细检查一下,我发现此文档特别有用
Both auditTime
and debounceTime
will initially start a timer when an event comes in. Both will wait the given amount of time before they emit an event. The difference is that debounceTime
resets the timer whenever a new event comes in while auditTime
does not. auditTime
will emit the most recent event after the given number of milliseconds whether or not it is still receiving events. debounceTime
will wait for a gap in the events. You said you read the documentation but just to double check I have found this document particularly helpful.
这篇关于rxjs中审核和反跳之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!