Skip to content

Commit

Permalink
Rename onerror to onreaderror. Replace activated reader list with pen…
Browse files Browse the repository at this point in the history
…ding read tuple.

Signed-off-by: Zoltan Kis <zoltan.kis@intel.com>
  • Loading branch information
zolkis committed Sep 23, 2020
1 parent 0f6cad2 commit 4aafd69
Showing 1 changed file with 25 additions and 35 deletions.
60 changes: 25 additions & 35 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1135,13 +1135,13 @@ <h4>
<section> <h3>Handle scanning errors</h3>
<p>
This example shows what happens when {{NDEFReader/scan}} promise rejects and
{{NDEFReader/onerror}} is fired.
{{NDEFReader/onreadingerror}} is fired.
</p>
<pre class="example">
const ndef = new NDEFReader();
ndef.scan().then(() => {
console.log("Scan started successfully.");
ndef.onerror = event => {
ndef.onreadingerror = event => {
console.log("Error! Cannot read data from the NFC tag. Try a different one?");
};
ndef.onreading = event => {
Expand Down Expand Up @@ -1988,7 +1988,7 @@ <h2>The <dfn>record type</dfn> string</h2>
interface NDEFReader : EventTarget {
constructor();

attribute EventHandler onerror;
attribute EventHandler onreadingerror;
attribute EventHandler onreading;

Promise&lt;undefined&gt; scan(optional NDEFScanOptions options={});
Expand Down Expand Up @@ -2079,7 +2079,7 @@ <h2>The <dfn>record type</dfn> string</h2>
which is called to notify that new reading is available.
</p>
<p>
The <dfn data-dfn-for="NDEFReader">onerror</dfn> is an {{EventHandler}}
The <dfn data-dfn-for="NDEFReader">onreadingerror</dfn> is an {{EventHandler}}
which is called to notify that an error happened during reading.
</p>
<section><h3>NFC state associated with the settings object</h3>
Expand Down Expand Up @@ -2109,10 +2109,11 @@ <h2>The <dfn>record type</dfn> string</h2>
</td>
</tr>
<tr>
<td><dfn>[[\ActivatedReaderList]]</dfn></td>
<td><dfn>[[\PendingRead]]</dfn></td>
<td>empty <a>set</a></td>
<td>
A <a>set</a> of {{NDEFReader}} instances.
A &lt;|promise:Promise|, |reader:NDEFReader|&gt; tuple where |promise|
holds a {{Promise}} and |reader| holds an {{NDEFReader}}.
</td>
</tr>
<tr>
Expand All @@ -2126,8 +2127,8 @@ <h2>The <dfn>record type</dfn> string</h2>
</tbody>
</table>
<p>
The <dfn>activated reader objects</dfn> is the value of the
<a>[[\ActivatedReaderList]]</a> internal slot.
The <dfn>pending read tuple</dfn> is the value of the
<a>[[\PendingRead]]</a> internal slot.
</p>
<p>
The <dfn>pending write tuple</dfn> is the value of the
Expand Down Expand Up @@ -2270,7 +2271,7 @@ <h2>The <dfn>record type</dfn> string</h2>
Stop the <a>dispatch NFC content</a> steps.
</li>
<li>
Clear the <a>activated reader objects</a>.
Clear the <a>pending read tuple</a>.
</li>
<li>
Release the NFC resources associated with |nfc| on the
Expand Down Expand Up @@ -3421,9 +3422,9 @@ <h3><dfn>Writing content</dfn></h3>
accessible to the client.
</p>
<p>
If there are any {{NDEFReader}} instances in <a>activated reader objects</a>
then the <a>UA</a> MUST listen to <a>NDEF message</a>s on all connected
NFC adapters.
If there is a <a>pending read tuple</a> whose |reader| is an
{{NDEFReader}} instance, then the <a>UA</a> MUST listen to
<a>NDEF message</a>s on all connected NFC adapters.
</p>

<section> <h3>The <strong>scan()</strong> method</h3>
Expand Down Expand Up @@ -3464,12 +3465,10 @@ <h3><dfn>Writing content</dfn></h3>
abort steps</a> to |reader|.<a>[[\ScanAbortSignal]]</a>:
<ol>
<li>
Remove the {{NDEFReader}} instance from the
<a>activated reader objects</a>.
Clear the <a>pending read tuple</a>.
</li>
<li>
If the <a>activated reader objects</a> [= list/is empty =],
then make a request to stop listening to <a>NDEF message</a>s
Make a request to stop listening to <a>NDEF message</a>s
on all <a>NFC adapter</a>s.
</li>
</ol>
Expand All @@ -3495,7 +3494,7 @@ <h3><dfn>Writing content</dfn></h3>
and abort these steps.
</li>
<li>
Add |reader| to the <a>activated reader objects</a>.
Set the <a>pending read tuple</a> to (|p|, |reader|).
</li>
<li>
Resolve |p|.
Expand All @@ -3520,14 +3519,10 @@ <h3><dfn>Writing content</dfn></h3>
If the <a>NFC tag</a> in proximity range does not expose <a>NDEF</a>
technology for reading or formatting, run the following sub-steps:
<ol>
<li>[= list/For each =]
{{NDEFReader}} instance |reader:NDEFReader| in the
<a>activated reader objects</a>, run the following sub-steps:
<ol>
<li>
<a>Fire an event</a> named "`error`" at |reader|.
</li>
</ol>
<li>
If there is a <a>pending read tuple</a> whose |reader| is an
{{NDEFReader}} instance, fire an event</a> named "`readingerror`" at
|reader|.
</li>
<li>
Abort these steps.
Expand Down Expand Up @@ -3594,16 +3589,11 @@ <h3><dfn>Writing content</dfn></h3>
</p>
<ol class=algorithm>
<li>
[= list/For each =] {{NDEFReader}} instance |reader:NDEFReader| in
the <a>activated reader objects</a>,
<ol>
<li>
<a>fire an event</a> named "`reading`" at |reader| using
<a>NDEFReadingEvent</a> with its <a>serialNumber</a> attribute
initialized to |serialNumber| and <a>message</a> attribute
initialized to |message|.
</li>
</ol>
If there is a <a>pending read tuple</a> whose |reader| is an
{{NDEFReader}} instance, <a>fire an event</a> named "`reading`" at
|reader| using <a>NDEFReadingEvent</a> with its <a>serialNumber</a>
attribute initialized to |serialNumber| and <a>message</a> attribute
initialized to |message|.
</li>
</ol>
</section>
Expand Down

0 comments on commit 4aafd69

Please sign in to comment.