JavaScript 节流函数实现详解
const throttle = (fn, wait) => { let lastTime = 0; return function(...args){ let nowTime = new Date().getTime(); if(nowTime - lastTime > wait){ fn.apply(this, args); lastTime = nowTime; } } }
原文地址: http://www.cveoy.top/t/topic/lhyL 著作权归作者所有。请勿转载和采集!