标签:settime this delay comm ide on() lse type deb
防抖
function debounce(fun,delay){
let timer = null
return function(){
if(timer){
clearTimeout(timer)
}
timer = setTimeout(()=>{
fun.apply(this,arguments)
},delay)
}
}
节流
function throttle(fun,delay){
let valid = true
return function(){
if(!valid) return
valid = false
setTimeout(()=>{
fun.apply(this,arguments)
valid = true
},delay)
}
}
new
function createObject(obj){
let ins
function F(){}
F.prototype = p
ins = new F()
return ins
}
防抖https://www.bilibili.com/video/BV1fB4y1F7Vd/?spm_id_from=333.788.recommend_more_video.3
防抖
防抖
防抖
``
标签:settime this delay comm ide on() lse type deb
原文地址:https://www.cnblogs.com/x-mao/p/14873509.html