码迷,mamicode.com
首页 > Web开发 > 详细

js防抖节流

时间:2020-05-02 14:38:53      阅读:52      评论:0      收藏:0      [点我收藏+]

标签:UNC   class   null   on()   bounce   csharp   deb   return   div   

debounce(fn,delay=500) {
   let timer = null
   return function(){
     if(timer){
       clearTimeout(timer)
     }
     timer = setTimeout(fn,delay)
   }
 }

  

js防抖节流

标签:UNC   class   null   on()   bounce   csharp   deb   return   div   

原文地址:https://www.cnblogs.com/fm060/p/12817975.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!