Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- https://jcon.tistory.com/189
- https://appmaster.io/ko/blog/rest-apiran-mueosimyeo-dareun-yuhyeonggwa-eoddeohge-dareungayo
- https://sewonzzang.tistory.com/22
- https://goodgid.github.io/HTTP-Communicate-Process/
- https://siyoon210.tistory.com/130
- https://hi-zini.tistory.com/entry/%EB%B9%84%EB%8F%99%EA%B8%B0%EC%A0%81-%EB%B0%A9%EC%8B%9D-%EC%B2%98%EB%A6%AC-%EB%B0%A9%EB%B2%95-Callback-Promise-async-await
- https://joshua1988.github.io/web-development/javascript/promise-for-beginners/
- https://subicura.com/2017/01/19/docker-guide-for-beginners-1.html
- https://joshua1988.github.io/web-development/javascript/js-async-await/
- https://aws.amazon.com/ko/docker/
Archives
- Today
- Total
“Connecting the dots”
async / await 본문
반응형
async/await
-비동기 처리 방식-
자바스크립트는 비동기처리가 필수적이다 비동기 처리는
그 결과가 언제 반환될지 알수 없기 때문에 동기시으로 처리하는 기법
대표적으로 SetTimeout,callback,promise 세가지 모두 비동기 코드를
동기식으로 작성
async와await 는 이런 문제들을 해결함과 동시에 사용법에 있어서도 훨씬 단순
문법
promise 문법
function p() {
return new Promise((resole,reject)=>{
resolve('hello');
});
}
p().then(n) => console.log(n);
async문법
async function p2(){
return 'hello2';
}
async로 지정해주면 promise를 리턴하는 함수로 만든다
async&await
function 키워드 앞에 async만 붙여주고 비동기 처리 부분 앞에 await 만 붙여주면된다
+async가 붙은 함수는 프라미스로 반환하고,프라미스가 아닌것은 프라미스로 감싼다
+async/await가 완벽하게 프라미스 함수를 대처 하는것으 아니다
+비동기는 promise객체로 처리하고
+async/await는 비동기를 동기식으로 처리
반응형
'2주차' 카테고리의 다른 글
SQL vs NoSQL (0) | 2022.11.09 |
---|---|
Scraping & Crawling (0) | 2022.11.07 |
package.json란? (0) | 2022.11.07 |
Callback / Promise 란 (0) | 2022.11.07 |
Docker란? (0) | 2022.11.07 |