52

一图秒懂函数防抖和函数节流

 5 years ago
source link: https://juejin.im/post/5c404329e51d4551e064a332
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
函数防抖(debounce)和函数节流(throttle)都是为了缓解函数频繁调用,它们相似,但有区别 如上图,一条竖线代表一次函数调用,函数防抖是间隔超过一定时间后才会执行,函数节流是一定时间段内只执行一次。 函数防抖实现 function debounc

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK