美文网首页
防抖与节流

防抖与节流

作者: EmilWong | 来源:发表于2019-07-15 14:05 被阅读0次

function debounce (handle, delay) {

  let timer = null

  return function () {

      let _this = this, args = arguments;

      clearTimeout(timer)

      timer = setTimeout(function () {

          handle.apply(_this, args)

      }, delay)

  }

}

相关文章

网友评论

      本文标题:防抖与节流

      本文链接:https://www.haomeiwen.com/subject/icrnkctx.html