LoginSignup
0
2

More than 5 years have passed since last update.

Promiseのテンプレート(非同期で並列処理)

Last updated at Posted at 2018-01-03

Promiseのテンプレート(非同期で並列処理)

Promise.resolve()
  .then(() => {
    return Promise.all([
      new Promise((resolve, reject) => {
        resolve(result1);
      }),
      new Promise((resolve, reject) => {
        resolve(result2);
      })
    ]);
  })
  .then((_result) => {
    return new Promise((resolve, reject) => {
      const result1 = _result[0];
      const result2 = _result[1];
      resolve();
    });
  });```
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2