Sorry. for koreans only. I'll add english short description. or just visit http://wtfjs.com
아오 썅.
정정사항입니다.
객체 동일비교는 항상 valueOf 결과물로 나온 비교로 하는 데다가,
객체와 배열은 valueOf 해봐야 객체로 나오기 때문에
객체와 배열은 == 하나 === 하나 같은 비용으로 비교합니다.
[1,2,3]==[1,2,3] 은 false가 되므로
[1,,,2]==[1,undefined,undefuned,2] 는 무조건 false로 나옵니다.
I started Nodejs web programming and programmed as Asynchronous. after suffering the callback hell(a Pyramid of Doom) I found a solution. It is the promise, async, await concepts and wanted to get to know that things. I was wondering why do javascript need promise concept and I wanted to get to know a relationship with async, await and Promise. This slide is the first content of my question, why need promise concept?
Sorry. for koreans only. I'll add english short description. or just visit http://wtfjs.com
아오 썅.
정정사항입니다.
객체 동일비교는 항상 valueOf 결과물로 나온 비교로 하는 데다가,
객체와 배열은 valueOf 해봐야 객체로 나오기 때문에
객체와 배열은 == 하나 === 하나 같은 비용으로 비교합니다.
[1,2,3]==[1,2,3] 은 false가 되므로
[1,,,2]==[1,undefined,undefuned,2] 는 무조건 false로 나옵니다.
I started Nodejs web programming and programmed as Asynchronous. after suffering the callback hell(a Pyramid of Doom) I found a solution. It is the promise, async, await concepts and wanted to get to know that things. I was wondering why do javascript need promise concept and I wanted to get to know a relationship with async, await and Promise. This slide is the first content of my question, why need promise concept?
2. 01 02 03 04
Promise란
무엇인가?
Promise
사용하기
Promise의
특징
Promise 직접
구현하기
전통적인 콜백 패
턴이 가지고 있는
문제와 Promise 정
의및 사용 방법에
대해서 개괄적으로
살펴본다.
Promise의 정적 메
서드와 인스턴스
메 서 드 , 그 리 고
thenable에 관한
개념 등 조금 더 다
양하고 자세한 내
용을 살펴본다.
Promise에 대해
잘 알려져 있지 않
는 중요한 특징 몇
가지를 소개한다.
ES6
23. 전통적인 콜백 패턴의 문제 1
여러운 비동기 예외 처리
3
try{
setTimeout(function(){
throw new Error('에러가 발생했다.');
}, 1000);
}catch(err){
console.error(err);
console.log('에러를 복구했다.');
}
24. 전통적인 콜백 패턴의 문제 1
여러운 비동기 예외 처리
try{
setTimeout(function(){
throw new Error('에러가 발생했다.');
}, 1000);
}catch(err){
console.error(err);
console.log('에러를 복구했다.');
}
global
4
25. 전통적인 콜백 패턴의 문제 1
여러운 비동기 예외 처리
try{
setTimeout(function(){
throw new Error('에러가 발생했다.');
}, 1000);
}catch(err){
console.error(err);
console.log('에러를 복구했다.');
}
global setTimeout() handler
호출
콜백 등록
5
26. 전통적인 콜백 패턴의 문제 1
여러운 비동기 예외 처리
try{
setTimeout(function(){
throw new Error('에러가 발생했다.');
}, 1000);
}catch(err){
console.error(err);
console.log('에러를 복구했다.');
}
global time eventsetTimeout() handler
호출
콜백 등록
발화
6
27. 전통적인 콜백 패턴의 문제 1
여러운 비동기 예외 처리
try{
setTimeout(function(){
throw new Error('에러가 발생했다.');
}, 1000);
}catch(err){
console.error(err);
console.log('에러를 복구했다.');
}
global time eventsetTimeout() handler
호출
콜백 등록
발화
예외
7
28. 전통적인 콜백 패턴의 문제 1
여러운 비동기 예외 처리
try{
setTimeout(function(){
throw new Error('에러가 발생했다.');
}, 1000);
}catch(err){
console.error(err);
console.log('에러를 복구했다.');
}
global time eventsetTimeout() handler
호출
콜백 등록
발화
예외 통지예외
8
43.
Constructor
var promise = new Promise(function(resolve, reject){
// 비동기 처리 작성
// 처리가 끝나면 resolve 또는 reject 호출
});
Instace Method Static Method
Promise.prototype.then(onFulfilled,
1010.
55
some().then(function(){
// do something...
}).then(function(){
// do something...
}).then(function(){
// do something...
}).then(function(){
// do something...
}).catch(function(){
// do something...
});