JSFiddle - React, Tailwind, and code Playground
by alexarg
HTML
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
JavaScript
var a = $.Deferred();
a.promise()
.then(function (result1) {
return result1 * 5;
})
.then(function (result2) {
return result2 + " as text";
})
.then(function (result3) {
var b = $.Deferred();
setTimeout(function () {
b.resolve(result3 + " delayed");
}, 100);
return b.promise();
})
.then(function (result4) {
alert(result4); // alerts "25 as text delayed"
});
a.resolve(5);