404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.117.154.75: ~ $
import {
  default as Enumerator,
  makeSettledResult
} from './enumerator';
import Promise from './promise';
import { isArray } from './utils';

class AllSettled extends Enumerator {
  constructor(Constructor, entries, label) {
    super(Constructor, entries, false /* don't abort on reject */, label);
  }
}

AllSettled.prototype._makeResult = makeSettledResult;

  /**
  `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing
  a fail-fast method, it waits until all the promises have returned and
  shows you all the results. This is useful if you want to handle multiple
  promises' failure states together as a set.

  Returns a promise that is fulfilled when all the given promises have been
  settled. The return promise is fulfilled with an array of the states of
  the promises passed into the `promises` array argument.

  Each state object will either indicate fulfillment or rejection, and
  provide the corresponding value or reason. The states will take one of
  the following formats:

  ```javascript
  { state: 'fulfilled', value: value }
    or
  { state: 'rejected', reason: reason }
  ```

  Example:

  ```javascript
  let promise1 = RSVP.Promise.resolve(1);
  let promise2 = RSVP.Promise.reject(new Error('2'));
  let promise3 = RSVP.Promise.reject(new Error('3'));
  let promises = [ promise1, promise2, promise3 ];

  RSVP.allSettled(promises).then(function(array){
    // array == [
    //   { state: 'fulfilled', value: 1 },
    //   { state: 'rejected', reason: Error },
    //   { state: 'rejected', reason: Error }
    // ]
    // Note that for the second item, reason.message will be '2', and for the
    // third item, reason.message will be '3'.
  }, function(error) {
    // Not run. (This block would only be called if allSettled had failed,
    // for instance if passed an incorrect argument type.)
  });
  ```

  @method allSettled
  @static
  @for RSVP
  @param {Array} entries
  @param {String} label - optional string that describes the promise.
  Useful for tooling.
  @return {Promise} promise that is fulfilled with an array of the settled
  states of the constituent promises.
  */

export default function allSettled(entries, label) {
  if (!isArray(entries)) {
    return Promise.reject(new TypeError("Promise.allSettled must be called with an array"), label);
  }

  return new AllSettled(Promise, entries, label).promise;
}



Filemanager

Name Type Size Permission Actions
promise Folder 0755
-internal.js File 5.6 KB 0644
all-settled.js File 2.34 KB 0644
all.js File 328 B 0644
asap.js File 2.86 KB 0644
config.js File 278 B 0644
defer.js File 1.13 KB 0644
enumerator.js File 2.92 KB 0644
events.js File 4.85 KB 0644
filter.js File 3.77 KB 0644
hash-settled.js File 3.83 KB 0644
hash.js File 2.73 KB 0644
instrument.js File 971 B 0644
map.js File 3.08 KB 0644
node.js File 6.79 KB 0644
platform.js File 262 B 0644
promise-hash.js File 1014 B 0644
promise.js File 10.32 KB 0644
race.js File 333 B 0644
reject.js File 466 B 0644
resolve.js File 484 B 0644
rethrow.js File 1.43 KB 0644
then.js File 903 B 0644
utils.js File 763 B 0644