full code here: http://jsfiddle.net/BurFz/ http://jsbin.com/dagequha/1/edit?js,console
/**
* Running this will work
*/
func1('arg1').then(func2).then(func3).then(function () {
console.log('all done!');
});
/**
* But this one doesn't work
*/
func1('arg1').then(func2('arg1')).then(func3('arg1', 'arg2')).then(function () {
console.log('all done!');
});
I have a 3 async functions in my code and I'm using jQuery deferred/promise technique to call them sequentially. It's working all right but the problem is that I can't pass these functions arguments. If you run my JS Bin(JSfiddle) sample you see it works, scroll down and use the second commented section(the one with arguments) instead of first one and it will stop working correctly. How can I pass arguments to func1, func2 and func3 and still call them sequentially?