두 API 호출이 반환되면 해결되는 약속 체인에 단일 약속을 적용하는 방법을 이해하는 데 문제가 있습니다.약속 체인 만들기
아래 코드를 약속 체인으로 어떻게 다시 작성합니까?
function parseTweet(tweet) {
indico.sentimentHQ(tweet)
.then(function(res) {
tweetObj.sentiment = res;
}).catch(function(err) {
console.warn(err);
});
indico.organizations(tweet)
.then(function(res) {
tweetObj.organization = res[0].text;
tweetObj.confidence = res[0].confidence;
}).catch(function(err) {
console.warn(err);
});
}
감사합니다.
간단하고 간단합니다. +1 –
감사합니다. – Dotnaught