var box = document.getElementById('box')
box.onclick = throttle(callBack, 500, 1, 2, 3, 4, 5, 6)
function callBack(...arg) {
console.log('事件对象及参数', arg)
}
function throttle(fn, wait, ...args) {
let timeout
return function(...e) {
if (!timeout) {
timeout = setTimeout(() => {
let ary = [...e, ...args]
fn.apply(this, ary)
timeout = null
}, wait)
}
}
}