I've an example from an online tutorial and I'm wondering how can I convert each then into async call?
Edit- Basically i want the promise to proceed with each call in an async fashion, or how it works out there. I'm new to promises, one promise mean single async call or a promise can have a several async calls and then callback at the end,
if i have following three function calls, how can I chain them to be async, right now they all fire immediately in a sequence?
Edit 2 - Improved my question based on learnings with Joel's support, I've a fiddle now http://jsfiddle.net/smartdev101/eLxxpjp3/
var q = require('q');
var defer = q.defer();
defer.promise
.then(function(weapon){
setTimeout(function(){console.log('wait')}, 2000);
console.log("You can have my " + weapon);
return "bow";
})
.then(function(weapon){
console.log("and my " + weapon);
return "axe";
})
.then(function(weapon){
console.log("and my " + weapon);
});
defer.resolve("sword");