How to use the rsvp.Promise.all function in rsvp

To help you get started, we’ve selected a few rsvp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github noironetworks / aci-containers / vendor / github.com / hashicorp / consul / ui-v2 / app / routes / dc.js View on Github external
willTransition: function(transition) {
      this._super(...arguments);
      if (
        typeof transition !== 'undefined' &&
        (transition.from.name.endsWith('nspaces.create') ||
          transition.from.name.startsWith('nspace.dc.acls.tokens'))
      ) {
        // Only when we create, reload the nspaces in the main menu to update them
        // as we don't block for those
        // And also when we [Use] a token reload the nspaces that you are able to see,
        // including your permissions for being able to manage namespaces
        // Potentially we should just do this on every single transition
        // but then we would need to check to see if nspaces are enabled
        Promise.all([
          this.nspacesRepo.findAll(),
          this.nspacesRepo.authorize(
            get(this.controller, 'dc.Name'),
            get(this.controller, 'nspace.Name')
          ),
        ]).then(([nspaces, permissions]) => {
          if (typeof this.controller !== 'undefined') {
            this.controller.setProperties({
              nspaces: nspaces,
              permissions: permissions,
            });
          }
        });
      }
    },
  },
github salsify / broccoli-css-modules / index.js View on Github external
build() {
    this._seen = Object.create(null);
    this.onBuildStart();

    // TODO this could cache much more than it currently does across rebuilds, but we'd need to be smart to invalidate
    // things correctly when dependencies change
    let processPromises = this.listFiles().map((sourcePath) => {
      return this.process(ensurePosixPath(sourcePath));
    });

    return Promise.all(processPromises)
      .then((result) => {
        this.onBuildSuccess();
        this.onBuildEnd();
        return result;
      })
      .catch((error) => {
        this.onBuildError();
        this.onBuildEnd();
        throw error;
      });
  }
github soumak77 / firebase-mock / test / unit / firestore-collection.js View on Github external
it('returns limited amount of documents', function() {
      var results1 = collection.limit(3).get();
      var results2 = collection.limit(1).get();
      var results3 = collection.limit(6).get();
      var results4 = collection.limit(10).get();
      db.flush();

      return Promise.all([
        expect(results1).to.eventually.have.property('size').to.equal(3),
        expect(results2).to.eventually.have.property('size').to.equal(1),
        expect(results3).to.eventually.have.property('size').to.equal(6),
        expect(results4).to.eventually.have.property('size').to.equal(6)
      ]);
    });
  });
github adopted-ember-addons / ember-impagination / tests / test-server.js View on Github external
rejectAll() {
    this.requests.forEach((request) => request.reject());
    return EmberPromise.all(this.requests);
  }
}
github discourse / discourse / app / assets / javascripts / wizard / lib / preview.js View on Github external
loadImages() {
        const images = this.images();
        if (images) {
          return Promise.all(
            Object.keys(images).map((id) => {
              return loadImage(images[id]).then((img) => (this[id] = img));
            })
          );
        }
        return Promise.resolve();
      },
github emberjs / data / packages / store / addon / -private / system / record-arrays / record-array.js View on Github external
save() {
    let promiseLabel = `DS: RecordArray#save ${this.modelName}`;
    let promise = Promise.all(this.invoke('save'), promiseLabel).then(
      () => this,
      null,
      'DS: RecordArray#save return RecordArray'
    );

    return PromiseArray.create({ promise });
  },
github emberjs / data / addon / -private / system / store.js View on Github external
_scheduleFetchMany(internalModels, options) {
    let fetches = new Array(internalModels.length);

    for (let i = 0; i < internalModels.length; i++) {
      fetches[i] = this._scheduleFetch(internalModels[i], options);
    }

    return Promise.all(fetches);
  },
github skaterdav85 / ember-share / index.js View on Github external
run: function(commandOptions, rawArgs) {
          var port = commandOptions.port;
          var self = this;

          var ngrokServer = new Promise(function(resolve, reject) {
            ngrok.connect(port, function(err, url) {
              ncp.copy(url);
              self.ui.writeLine('Your sharable URL is ' + url + ' and has been copied to your clipboard.');
              resolve();
            });
          });

          return Promise.all([ngrokServer, this._super.run.apply(this, arguments)]);
        }
      })
github discourse / discourse-encrypt / assets / javascripts / discourse / initializers / hook-encrypt-upload.js.es6 View on Github external
});

        const iv = window.crypto.getRandomValues(new Uint8Array(12));

        const encryptedPromise = Promise.all([
          decryptedPromise,
          keyPromise
        ]).then(([decrypted, key]) => {
          return window.crypto.subtle.encrypt(
            { name: "AES-GCM", iv, tagLength: 128 },
            key,
            decrypted
          );
        });

        Promise.all([encryptedPromise, exportedKeyPromise, dataPromise]).then(
          ([encrypted, exportedKey, data]) => {
            uploadsKeys[file.name] = exportedKey;
            uploadsType[file.name] = file.type;
            uploadsData[file.name] = data;

            const blob = new Blob([iv, encrypted], {
              type: "application/x-binary"
            });
            const f = new File([blob], `${file.name}.encrypted`);
            editor.$().fileupload("send", {
              files: [f],
              originalFiles: [f],
              formData: { type: "composer" }
            });
          }
        );