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