1. function throttle(fn, time) {
    2. let flag = false;
    3. return function () {
    4. if (flag) return
    5. flag = true
    6. setTimeout(() => {
    7. fn.apply(this, arguments)
    8. flag = false
    9. }, time);
    10. }
    11. }