Skip to Content
자바스크립트 + 리액트 디자인 패턴
book

자바스크립트 + 리액트 디자인 패턴

by 애디 오스마니(Addy Osmani), 윤창식
August 2024
Beginner to intermediate
384 pages
7h 38m
Korean
Hanbit Media, Inc.
Content preview from 자바스크립트 + 리액트 디자인 패턴
220
자바스크립트 + 리액트 디자인 패턴
9.4.10
async
/
await
데코레이터
async
/
await
데코레이터
async
/
await
Decorator
패턴은 고차
high
-
order
함수를 사용하여 데코레이
decorator
01
를 생성합니다. 이 데코레이터는 비동기 함수에 적용되어 추가적인 기능을 제공합
니다.
function asyncLogger(fn) {
return async function (...args) {
console.log("Starting async function...");
const result = await fn(...args);
console.log("Async function completed.");
return result;
};
}
@asyncLogger
async function main() {
const data = await makeRequest("http://example.com/");
console.log(data);
}
9.5
실용적인 예제 더보기
앞서 살펴본 패턴 외에도, 자바스크립트에서
async
/
await
를 활용하는 몇 가지 실용적인 예
시를 알아보겠습니다.
9.5.1
HTTP
요청 보내기
async function makeRequest(url) {
01
옮긴이_ 데코레이터는 현재
ECMAScript
표준의 일부로 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

AI를 위한 필수 수학

AI를 위한 필수 수학

할라 넬슨
클라우드 엔지니어를 위한 97가지 조언

클라우드 엔지니어를 위한 97가지 조언

Emily Freeman, Nathen Harvey, 정기훈(Jung Ki Hun)

Publisher Resources

ISBN: 9791169212571