function throttle(fn, time) { let flag = false; return function () { if (flag) return flag = true setTimeout(() => { fn.apply(this, arguments) flag = false }, time); }}