Tag: 断链

如何正确摆脱承诺链?

基于这里的问题: jQuery链接和级联然后是什么时候的和接受的答案。 我想打破承诺链,但还没有找到正确的方法。 有关于这个多个 职位 ,但我仍然失去了。 以原问题为例: Menus.getCantinas().then(function(cantinas){ // `then` is how we chain promises Menus.cantinas = cantinas; // if we need to aggregate more than one promise, we `$.when` return $.when(Menus.getMeals(cantinas), Menus.getSides(cantinas)); }).then(function(meals, sides){ // in jQuery `then` can take multiple arguments Menus.sides = sides; // we can fill closure arguments here Menus.meals = […]