Jason Chen

Results 2 comments of Jason Chen

``` 防抖:短时间内大量触发同一事件,只会执行一次函数 function debounce(fn, delay) { let timer = null return function () { if(!timer) return timer = setTimeout(fn, delay) } } 节流:短时间内大量触发同一事件,那么函数执行后,函数在指定时间内不会再触发,等过了该时间才会重新生效。 function throttle(fn, delay) { let flag =...

``` 1 7 6 8 2 4 3 5 9 11 10 12 分析: 1. promise resolve之前是同步的,then才是异步的 2. process.nextTick优先于setTimeout、promise.then ```