blob: a063f29c7cfa982f1304f2c1d41ec19296fecf77 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
---
title: Promise.allSettled()
slug: Web/JavaScript/Reference/Global_Objects/Promise/allSettled
translation_of: Web/JavaScript/Reference/Global_Objects/Promise/allSettled
---
<p>{{JSRef}}</p>
<p><code><strong>Promise.allSettled()</strong></code> 메소드는 배열이나 별도의 나열 가능한 객체를 통해 나열된 Promise모음이 모두 이행하거나 거부했을 때에 대한 대응을 할 수 있는 Promise 객체를 반환한다.</p>
<div>{{EmbedInteractiveExample("pages/js/promise-allsettled.html")}}</div>
<h2 id="문법">문법</h2>
<pre class="syntaxbox"><em>Promise</em>.allSettled(<em>iterable</em>);</pre>
<h3 id="인자">인자</h3>
<dl>
<dt><code>iterable</code></dt>
<dd><a href="/en-US/docs/Web/JavaScript/Guide/iterable">iterable</a> 객체로, 주로 배열({{jsxref("Array")}})을 사용하며, 이들의 요소들은 모두 <code>Promise</code> 객체.</dd>
</dl>
<h3 id="반환_값">반환 값</h3>
<p><strong>실행할</strong> {{jsxref("Promise")}} 객체로 <strong>비동기</strong> 방식으로 이행(Resolved) 및 거부(Rejected)된 결과의 모음을 담아 인자로 전달된다. 이 때 반환된 Promise 객체의 핸들러는 각 본래 Promise 객체가 담긴 배열을 전달할 것이다.</p>
<p>각 출력 객체는 <code>status</code> 속성을 통해, <code>fulfilled</code>,상태로 전달되면 <code>value</code> 속성이 전달되고, <code>rejected</code> 상태로 전달 시 <code>reason</code> 속성으로 전달된다. 각 Promise가 어떻게 이행(또는 거부)됐는지 value 속성 및 reason 속성을 통해 알 수 있다.</p>
<h2 id="문서_표준">문서 표준</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td><a href="https://tc39.es/proposal-promise-allSettled/#sec-promise.allsettled"><code>Promise.allSettled()</code> (TC39 Stage 4 Draft)</a></td>
<td>{{Spec2('ESDraft')}}</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="지원_브라우저">지원 브라우저</h2>
<p class="hidden">To contribute to this compatibility data, please write a pull request against this repository: <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a>.</p>
<p>{{Compat("javascript.builtins.Promise.allSettled")}}</p>
<h3 id="구현_진행_상태">구현 진행 상태</h3>
<p>The following table provides a daily implementation status for this feature, because this feature has not yet reached cross-browser stability. The data is generated by running the relevant feature tests in <a href="https://github.com/tc39/test262">Test262</a>, the standard test suite of JavaScript, in the nightly build, or latest release of each browser's JavaScript engine.</p>
<div>{{EmbedTest262ReportResultsTable("Promise.allSettled")}}</div>
<h2 id="같이_보기">같이 보기</h2>
<ul>
<li><a href="/en-US/docs/Archive/Add-ons/Techniques/Promises">Promises</a></li>
<li><a href="/en-US/docs/Web/JavaScript/Guide/Using_promises">Using promises</a></li>
<li><a href="/en-US/docs/Learn/JavaScript/Asynchronous/Promises">Graceful asynchronous programming with promises</a></li>
<li>{{jsxref("Promise")}}</li>
<li>{{jsxref("Promise.all()")}}</li>
</ul>
|