How do you work with an array of jQuery Deferreds?

前端 未结 4 1127
余生分开走
余生分开走 2020-11-22 15:02

I have an application that requires data be loaded in a certain order: the root URL, then the schemas, then finally initialize the application with the schemas and urls for

4条回答
  •  遥遥无期
    2020-11-22 15:46

    If you are using ES6 version of javascript There is a spread operator(...) which converts array of objects to comma separated arguments.

    $.when(...promises).then(function() {
     var schemas=arguments; 
    };
    

    More about ES6 spread operator https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator find here

提交回复
热议问题