Debouce로 알아보는 Closure
검색 기능을 구현 할때 불필요한 요청을 줄이기위해 debounce를 구현해서 요청을 줄인다. 보통은 라이브러리(Lodash)를 많이 사용하지만 직접 구현 해보기로 했다
💡
Debounce : 일정 시간안에 연속되어 발생되는 이벤트를 마지막 이벤트만 콜백 함수를 실행 시킨다.
function debounce(callback, delay = 500) {
let timer = null
return (...args) => {
...
yunkoo.hashnode.dev2 min read