Wie mache ich eine Rückrufkette mit q?
Ich habe einige Probleme zu verstehen, wie "q" (https://github.com/kriskowal/q) eine Bibliothek für Javascript verspricht:
var delayOne = function() {
setTimeout(function() {
return 'hi';
}, 100);
};
var delayTwo = function(preValue) {
setTimeout(function() {
return preValue + ' my name';
}, 200);
};
var delayThree = function(preValue) {
setTimeout(function() {
return preValue + ' is bodo';
}, 300);
};
var delayFour = function(preValue) {
setTimeout(function() {
console.log(preValue);
}, 400);
};
Q.fcall(delayOne).then(delayTwo).then(delayThree).then(delayFour).end();
Dies gibt nur undefiniert zurück ...