Version 3.18.1
Show:

File: promise/js/batch.js

  1. /**
  2. Returns a new promise that will be resolved when all operations have completed.
  3. Takes both any numer of values as arguments. If an argument is a not a promise,
  4. it will be wrapped in a new promise, same as in `Y.when()`.
  5. @for YUI
  6. @method batch
  7. @param {Any} operation* Any number of Y.Promise objects or regular JS values
  8. @return {Promise} Promise to be fulfilled when all provided promises are
  9. resolved
  10. **/
  11. Y.batch = function () {
  12. return Promise.all(slice.call(arguments));
  13. };