SOURCE

function throttle (fn, delay) {
  let last = 0, timer = null
  
  return function () {
    let args = arguments
    let now = Date.now()
    if (now - last < delay) {
      clearTimeout(timer)
      timer = setTimeout(() => {
        last = now
        fn.apply(this, args)
      }, delay)
    } else {
      last = now
      fn.apply(this, args)
    }
  }
}
console 命令行工具 X clear

                    
>
console