摘要: 1.防抖 防抖:在高频触发下,在n秒内只触发一次(非严格)。如果n秒内再次触发,则重新计时 //实现debounce function debounce(fn){ let timer = null //创建一个命名存放定时器返回值 return function (){ clearTimeout(t 阅读全文
posted @ 2021-03-12 11:27 xiaoxu1024 阅读(87) 评论(0) 推荐(0)
摘要: 1.简单实现promise //手写实现promise,promiseAll,promiseRace function myPromise(excutor){ this.status = 'pending' //初始状态 this.value = null //存储传入的参数值 this.onRes 阅读全文
posted @ 2021-03-12 10:37 xiaoxu1024 阅读(187) 评论(0) 推荐(0)