- From: Jeffrey Yasskin <notifications@github.com>
- Date: Wed, 07 Jun 2017 09:49:53 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/437/review/42666050@github.com>
jyasskin commented on this pull request. > + {{DOMException}}. + <li>Reject immediately if the {{AbortSignal}}'s [=AbortSignal/aborted flag=] is already set, + otherwise: + <li>Use the [=AbortSignal/abort algorithms=] mechanism to observe changes to the {{AbortSignal}} + object and do so in a manner that does not lead to clashes with other observers. +</ul> + +<div class=example id=aborting-ongoing-activities-spec-example> + The steps for a promise-returning method <code>doAmazingness(options)</code> could be as follows: + + <ol> + <li>Let |p| be [=a new promise=]. + <li>If |options|' <code>signal</code> member is present, then: + <ol> + <li>If |options|' <code>signal</code>'s [=AbortSignal/aborted flag=] is set, throw an + "{{AbortError}}" {{DOMException}}. I think it's not as widely appreciated as it should be and could use a note. Folks tend not to know about the "If op has a return type that is a promise type" part of https://heycam.github.io/webidl/#dfn-create-operation-function. Or you could be less subtle: wait to create *p* until you need to store it or go *in parallel*, and "return [a promise rejected with](https://www.w3.org/2001/tag/doc/promises-guide#a-promise-rejected-with) ..." here. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/pull/437#discussion_r120682682
Received on Wednesday, 7 June 2017 16:50:31 UTC