블로그 이미지

Gicomong (Lux)

  • 분류 전체보기
    • 개발 기술
      • 사소하지만 놓치기 쉬운 개발 지식
      • css 애니메이션 (with js)
      • 개발 이야기
      • jest로 테스트하자
      • 함수형 프로그래밍
      • 타입스크립트
    • 사용자의 접근성 높이는 방법
      • W3C 기준
    • 조직 문화
    • 이번엔 이 공부 끝내겠다 시리즈
      • 테스트코드
      • github actions
      • 정규표현식
    • 라이브러리 파헤치기
    • error log
    • 주저리
Visits

Mong dev blog

  • 관리
  • 글쓰기
  • 방명록
  • 로그인
  • 로그아웃

Promise.allSettled2

[JS/Eslint] 반복문에서 await를 쓰지말자(no-await-in-loop)
이번 시간에는 eslint 룰 중 하나인, no-await-in-loop에 대해 알아보았다! 1. eslint룰, no-await-in-loop 1) 이 규칙은? 반복문에서 await 사용을 막는 규칙이다. 만약, 프로미스 간에 정해진 순서가 있는 경우 반복문에서 await를 쓸 수 있으나 프로미스 간에 정해진 순서가 없는 경우 반복문에서 await를 쓰는 건 성능상 좋지 않다. for (const person of people) { const response = await getPersonId(person); // ❌ } 🤔 그럼 성능을 향상시키면서, (정해진 순서가 없는)여러 프로미스을 처리하고 싶다면 어떻게 해야할까? Promise.all을 쓰자! 2) Promise.all로 처리하자! (1) Pr..
2022. 8. 27.
Promise.allSettled?
😆 이번시간에는 promise.all과 유사한 promise.allSettled에 대해 알아보았다! 1. Promise.allSettled의 필요성 여러 프로미스 객체를 병렬적으로 진행할 때, 우리는 Promise.all을 사용할 수 있다. const promise1 = Promise.resolve(3); const promise2 = Promise.resolve(4); Promise.all([promise1, promise2]).then(() => { console.log('success'); }); // success 단 Promise.all의 경우, 하나의 프로미스라도 실패하면 에러로 처리된다. const promise1 = Promise.resolve(3); const promise..
2022. 3. 13.
이전 1 다음

티스토리툴바