- From: Jeffrey Yasskin <notifications@github.com>
- Date: Tue, 11 Apr 2017 17:47:26 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/437/review/32260335@github.com>
jyasskin approved this pull request. > +</pre> +<dl class=domintro> + <dt><code><var>controller</var> = new <a constructor lt="AbortController()">AbortController</a>()</code> + <dd>Returns a new <var>controller</var> whose {{AbortController/signal}} is set to a newly + created {{AbortSignal}} object. + + <dt><code><var>controller</var> . </code>{{AbortController/signal}} + <dd>Returns the {{AbortSignal}} object associated with this object. + + <dt><code><var>controller</var> . </code>{{AbortController/abort()}} + <dd>Invoking this method will set this object's {{AbortSignal}}'s [=AbortSignal/aborted flag=], + thereby signaling to any observers that the associated activity should be aborted. + </dl> + +The <dfn attribute for=AbortController><code>signal</code></dfn> attribute must return the value to +which it was initialized. When a {{AbortController}} is created, the attribute must be initialized "an AbortController" > + created {{AbortSignal}} object. + + <dt><code><var>controller</var> . </code>{{AbortController/signal}} + <dd>Returns the {{AbortSignal}} object associated with this object. + + <dt><code><var>controller</var> . </code>{{AbortController/abort()}} + <dd>Invoking this method will set this object's {{AbortSignal}}'s [=AbortSignal/aborted flag=], + thereby signaling to any observers that the associated activity should be aborted. + </dl> + +The <dfn attribute for=AbortController><code>signal</code></dfn> attribute must return the value to +which it was initialized. When a {{AbortController}} is created, the attribute must be initialized +to a newly created {{AbortSignal}} object. + +The <dfn method for=AbortController><code>abort()</code></dfn> method, when invoked, must <a +for=AbortSignal>signal abort</a> on this object's {{AbortController/signal}}. You can probably write the link as `[=AbortSignal/signal abort=]`, although I haven't tested that with DOM's build system. > + }); + } + </pre> + + APIs that require more granular control could extend both {{AbortController}} and {{AbortSignal}} + according to their needs. +</div> + +<h3 id=interface-abortcontroller>Interface {{AbortController}}</h3> + +<pre class="idl"> +[Constructor(), Exposed=(Window,Worker)] +interface AbortController { + [SameObject] readonly attribute AbortSignal signal; + + void abort(); I agree with your choice to return `void` here. In particular, I expect that returning ["a Promise that is settled when cancellation has completed"](https://github.com/rbuckton/prex/blob/master/docs/cancellation.md#sourcecancel) will encourage developers to miss the fact that "an API listening to a signal may choose to ignore it" and so write bugs. -- 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#pullrequestreview-32260335
Received on Wednesday, 12 April 2017 00:48:05 UTC