函数防抖

函数防抖:高频去触发函数时,只执行一次

function antiShake(func, delay){
            var timer = null;
            return function(...argus){
                var _this = this
                clearTimeout(timer);
                timer = setTimeout(function(){
                    func.apply(_this, argus);
                }, delay);
            }
        }
posted @ 2020-07-11 09:34  Cupid05  阅读(30)  评论(0编辑  收藏  举报