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

js中的截流

时间:2017-05-12 09:40:35      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:his   function   time   func   cti   event   eve   clear   listen   

componentDidMount(){
  let timeoutId
  function callback(){

  }
  window.addEventListener(‘scroll‘,function(){
    if(this.props.isLoadingMore){
      return
    }
    if(timeoutId){
      clearTimeout(timeoutId)
    }
    timeoutId = setTimeout(callback,50)
  }.bind(this),false)
}

js中的截流

标签:his   function   time   func   cti   event   eve   clear   listen   

原文地址:http://www.cnblogs.com/zhangxintong1314/p/6843895.html

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