Skip to content

Commit 4aafd69

Browse files
committed
Rename onerror to onreaderror. Replace activated reader list with pending read tuple.
Signed-off-by: Zoltan Kis <[email protected]>
1 parent 0f6cad2 commit 4aafd69

File tree

1 file changed

+25
-35
lines changed

1 file changed

+25
-35
lines changed

index.html

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,13 +1135,13 @@ <h4>
11351135
<section> <h3>Handle scanning errors</h3>
11361136
<p>
11371137
This example shows what happens when {{NDEFReader/scan}} promise rejects and
1138-
{{NDEFReader/onerror}} is fired.
1138+
{{NDEFReader/onreadingerror}} is fired.
11391139
</p>
11401140
<pre class="example">
11411141
const ndef = new NDEFReader();
11421142
ndef.scan().then(() => {
11431143
console.log("Scan started successfully.");
1144-
ndef.onerror = event => {
1144+
ndef.onreadingerror = event => {
11451145
console.log("Error! Cannot read data from the NFC tag. Try a different one?");
11461146
};
11471147
ndef.onreading = event => {
@@ -1988,7 +1988,7 @@ <h2>The <dfn>record type</dfn> string</h2>
19881988
interface NDEFReader : EventTarget {
19891989
constructor();
19901990

1991-
attribute EventHandler onerror;
1991+
attribute EventHandler onreadingerror;
19921992
attribute EventHandler onreading;
19931993

19941994
Promise&lt;undefined&gt; scan(optional NDEFScanOptions options={});
@@ -2079,7 +2079,7 @@ <h2>The <dfn>record type</dfn> string</h2>
20792079
which is called to notify that new reading is available.
20802080
</p>
20812081
<p>
2082-
The <dfn data-dfn-for="NDEFReader">onerror</dfn> is an {{EventHandler}}
2082+
The <dfn data-dfn-for="NDEFReader">onreadingerror</dfn> is an {{EventHandler}}
20832083
which is called to notify that an error happened during reading.
20842084
</p>
20852085
<section><h3>NFC state associated with the settings object</h3>
@@ -2109,10 +2109,11 @@ <h2>The <dfn>record type</dfn> string</h2>
21092109
</td>
21102110
</tr>
21112111
<tr>
2112-
<td><dfn>[[\ActivatedReaderList]]</dfn></td>
2112+
<td><dfn>[[\PendingRead]]</dfn></td>
21132113
<td>empty <a>set</a></td>
21142114
<td>
2115-
A <a>set</a> of {{NDEFReader}} instances.
2115+
A &lt;|promise:Promise|, |reader:NDEFReader|&gt; tuple where |promise|
2116+
holds a {{Promise}} and |reader| holds an {{NDEFReader}}.
21162117
</td>
21172118
</tr>
21182119
<tr>
@@ -2126,8 +2127,8 @@ <h2>The <dfn>record type</dfn> string</h2>
21262127
</tbody>
21272128
</table>
21282129
<p>
2129-
The <dfn>activated reader objects</dfn> is the value of the
2130-
<a>[[\ActivatedReaderList]]</a> internal slot.
2130+
The <dfn>pending read tuple</dfn> is the value of the
2131+
<a>[[\PendingRead]]</a> internal slot.
21312132
</p>
21322133
<p>
21332134
The <dfn>pending write tuple</dfn> is the value of the
@@ -2270,7 +2271,7 @@ <h2>The <dfn>record type</dfn> string</h2>
22702271
Stop the <a>dispatch NFC content</a> steps.
22712272
</li>
22722273
<li>
2273-
Clear the <a>activated reader objects</a>.
2274+
Clear the <a>pending read tuple</a>.
22742275
</li>
22752276
<li>
22762277
Release the NFC resources associated with |nfc| on the
@@ -3421,9 +3422,9 @@ <h3><dfn>Writing content</dfn></h3>
34213422
accessible to the client.
34223423
</p>
34233424
<p>
3424-
If there are any {{NDEFReader}} instances in <a>activated reader objects</a>
3425-
then the <a>UA</a> MUST listen to <a>NDEF message</a>s on all connected
3426-
NFC adapters.
3425+
If there is a <a>pending read tuple</a> whose |reader| is an
3426+
{{NDEFReader}} instance, then the <a>UA</a> MUST listen to
3427+
<a>NDEF message</a>s on all connected NFC adapters.
34273428
</p>
34283429

34293430
<section> <h3>The <strong>scan()</strong> method</h3>
@@ -3464,12 +3465,10 @@ <h3><dfn>Writing content</dfn></h3>
34643465
abort steps</a> to |reader|.<a>[[\ScanAbortSignal]]</a>:
34653466
<ol>
34663467
<li>
3467-
Remove the {{NDEFReader}} instance from the
3468-
<a>activated reader objects</a>.
3468+
Clear the <a>pending read tuple</a>.
34693469
</li>
34703470
<li>
3471-
If the <a>activated reader objects</a> [= list/is empty =],
3472-
then make a request to stop listening to <a>NDEF message</a>s
3471+
Make a request to stop listening to <a>NDEF message</a>s
34733472
on all <a>NFC adapter</a>s.
34743473
</li>
34753474
</ol>
@@ -3495,7 +3494,7 @@ <h3><dfn>Writing content</dfn></h3>
34953494
and abort these steps.
34963495
</li>
34973496
<li>
3498-
Add |reader| to the <a>activated reader objects</a>.
3497+
Set the <a>pending read tuple</a> to (|p|, |reader|).
34993498
</li>
35003499
<li>
35013500
Resolve |p|.
@@ -3520,14 +3519,10 @@ <h3><dfn>Writing content</dfn></h3>
35203519
If the <a>NFC tag</a> in proximity range does not expose <a>NDEF</a>
35213520
technology for reading or formatting, run the following sub-steps:
35223521
<ol>
3523-
<li>[= list/For each =]
3524-
{{NDEFReader}} instance |reader:NDEFReader| in the
3525-
<a>activated reader objects</a>, run the following sub-steps:
3526-
<ol>
3527-
<li>
3528-
<a>Fire an event</a> named "`error`" at |reader|.
3529-
</li>
3530-
</ol>
3522+
<li>
3523+
If there is a <a>pending read tuple</a> whose |reader| is an
3524+
{{NDEFReader}} instance, fire an event</a> named "`readingerror`" at
3525+
|reader|.
35313526
</li>
35323527
<li>
35333528
Abort these steps.
@@ -3594,16 +3589,11 @@ <h3><dfn>Writing content</dfn></h3>
35943589
</p>
35953590
<ol class=algorithm>
35963591
<li>
3597-
[= list/For each =] {{NDEFReader}} instance |reader:NDEFReader| in
3598-
the <a>activated reader objects</a>,
3599-
<ol>
3600-
<li>
3601-
<a>fire an event</a> named "`reading`" at |reader| using
3602-
<a>NDEFReadingEvent</a> with its <a>serialNumber</a> attribute
3603-
initialized to |serialNumber| and <a>message</a> attribute
3604-
initialized to |message|.
3605-
</li>
3606-
</ol>
3592+
If there is a <a>pending read tuple</a> whose |reader| is an
3593+
{{NDEFReader}} instance, <a>fire an event</a> named "`reading`" at
3594+
|reader| using <a>NDEFReadingEvent</a> with its <a>serialNumber</a>
3595+
attribute initialized to |serialNumber| and <a>message</a> attribute
3596+
initialized to |message|.
36073597
</li>
36083598
</ol>
36093599
</section>

0 commit comments

Comments
 (0)