Sequential call of promises
问题 I am having an issue with the order in which promises/functions get called. Basically I fetch an array of ID and then, for each id, want to fetch order detail and save. Then on to the next ID. As of now it will not save until every single order detail has been fetched. The code: // Convenience function var fetchOrders = function() { return self.fetchOrderList() .then(function(orders) { return P.map(orders, function(r) { return self.fetchOrderById(r.id).then(fn); }); }); }; // Fetch initial