★ wanayoo — archive 1999 https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Promise/allNouvelle recherche | Portail wanayoo

Join MDN and developers like you at Mozilla's View Source conference, November 2-4 in Portland, Oregon. Learn more at https://viewsourceconf.org/.

Promise.all()

by 1 contributor:

This article is in need of an editorial review.

This translation is incomplete. Please help translate this article from English.

これは Harmony(ECMAScript 6) 提案の一部であり、実験段階の技術です。
この技術の仕様は安定していません。ブラウザ互換性の一覧表を確認してください。またこれらの構文や動作は、仕様変更などにより、新しいバージョンのブラウザでは変更される可能性があるという点に注意してください。

概要

反復引数のプロミスのすべてが完了したとき、完了プロミスを返します。

構文

Promise.all(iterable);

引数

iterable
Arrayのような反復オブジェクト。iterableを確かめて下さい。

説明

すべてのプロミスから値の配列として結果が渡されます。反復配列で渡された引数がプロミスでないなら、Promise.resolveによって変換されます。プロミスにわたされた引数がリジェクトされたら、すべての プロミスはすぐにそのリジェクトした値でリジェクトします。完了しているかどうかに関係なく、すべての他のプロミスを破棄します。

例

var promise = Promise.resolve(3);
Promise.all([true, promise])
       .then(values => {
           console.log(values); // [true, 3]
        });

仕様

仕様 状況 コメント
domenic/promises-unwrapping Draft Standardization work is taking place here.
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'Promise.all' in that specification.
Standard Initial definition in an ECMA standard.

ブラウザ実装状況

機能 Chrome Firefox (Gecko) Internet Explorer Opera Safari
基本サポート 32 29.0 (29.0) 未サポート 19 7.1
機能 Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
基本サポート 未サポート 29.0 (29.0) 未サポート 未サポート iOS 8 32

関連情報

ドキュメントのタグと貢献者

Contributors to this page: shide55
最終更新者: shide55,