const testThrottle = function(...rest) { console.log('ddd', rest) } let testThrottleFn = throttle(testThrottle, 2000) document.onmousemove = function(e) { testThrottleFn(e, '节流') } function throttle(fn, delay){ let pre = 0; return function() { let now = new Date(); let _this = this; let args = arguments; if(now - pre > delay) { fn.apply(_this, args) pre = now; } } }