防抖与节流

function debounce (handle, delay) {

  let timer = null

  return function () {

      let _this = this, args = arguments;

      clearTimeout(timer)

      timer = setTimeout(function () {

          handle.apply(_this, args)

      }, delay)

  }

}

你可能感兴趣的:(防抖与节流)