浅谈互联网三高:高并发、高性能、高
613 2023-04-03 04:55:59
1.可以当做全局变量给某一块使用【封装私有的变量与方法】
2.闭包作为回调函数
3.函数节流和防抖
防流; 太快了,前后重叠在一起了,需要给个时间定时
节流:一段时间内内容很多也需要给个时间
let fangDou=function(func,deny){let timer=null;let this=that; return function(){ if(timer){ clearTimeout(timer); } timer=setTimeout(,function(){ func.apply(that,args);},1000); }}
参考自:https://wenku.baidu.com/view/c0fa03344731b90d6c85ec3a87c24028905f8557.html