Re: [whatwg/webidl] Introduce "mark as handled" for promises (PR #1090)

@domenic commented on this pull request.



>  </div>
 
-This phrase is useful when you wish to aggregate the results of multiple promises, and then produce
-another promise from them, in the same way that {{Promise/all()|Promise.all()}} functions for
-JavaScript code.
+<div algorithm>
+    To <dfn export lt="mark a promise as handled|mark as handled">mark as handled</dfn> a
+    <code><a interface>Promise</a>&lt;<var ignore>T</var>&gt;</code> |promise|, set
+    |promise|.\[[Promise]].\[[PromiseIsHandled]] to true.
+
+    <p class="note">This definition is useful for promises which you expect rejections to often be
+    ignored; it ensures such promises do not cause {{Window/unhandledrejection}} events. The most
+    common use case is for promise properties, which the web developer might or might not consult.
+    An example is the {{WritableStreamDefaultWriter/closed|writableStreamWriter.closed}} promise,
+    which is [=marked as handled=] immediately after it is [=rejected=].

For now I just removed "which is marked as handled immediately after it is rejected" to make it a bit more vague.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/pull/1090#discussion_r798058627
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/pull/1090/review/871169949@github.com>

Received on Wednesday, 2 February 2022 22:16:48 UTC