Skip to content

Commit a71bff9

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

File tree

1 file changed

+31
-45
lines changed

1 file changed

+31
-45
lines changed

index.html

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -980,11 +980,11 @@ <h4>
980980

981981
<section><h3>Feature support</h3>
982982
<p>
983-
Detecting if Web NFC is supported can be done by checking NDEFReader
984-
objects. Note that this does not guarantee that NFC hardware is available.
983+
Detecting if Web NFC is supported can be done by checking the {{NDEFReader}}
984+
object. Note that this does not guarantee that NFC hardware is available.
985985
</p>
986986
<pre class="example">
987-
if ('NDEFReader' in window) { /* ... Scan or write NDEF Tags */ }
987+
if ('NDEFReader' in window) { /* ... Scan and write NDEF Tags */ }
988988
</pre>
989989
</section>
990990

@@ -1136,13 +1136,13 @@ <h4>
11361136
<section> <h3>Handle scanning errors</h3>
11371137
<p>
11381138
This example shows what happens when {{NDEFReader/scan}} promise rejects and
1139-
{{NDEFReader/onerror}} is fired.
1139+
{{NDEFReader/onreadingerror}} is fired.
11401140
</p>
11411141
<pre class="example">
11421142
const ndef = new NDEFReader();
11431143
ndef.scan().then(() => {
11441144
console.log("Scan started successfully.");
1145-
ndef.onerror = event => {
1145+
ndef.onreadingerror = event => {
11461146
console.log("Error! Cannot read data from the NFC tag. Try a different one?");
11471147
};
11481148
ndef.onreading = event => {
@@ -1978,9 +1978,9 @@ <h2>The <dfn>record type</dfn> string</h2>
19781978
<section> <h2>The NDEFReader object</h2>
19791979
<p>
19801980
The <dfn>NDEFReader</dfn> is an object that exposes NFC functionality to the
1981-
<a>browsing context</a>: reading data when a device, such as a tag, is within
1982-
the magnetic induction field. Also, it is used for writing
1983-
<a>NDEF message</a>s to <a>NFC tag</a>s within range.
1981+
<a>browsing context</a>: reading <a>NDEF messages</a> when a device, such
1982+
as a tag, is within the magnetic induction field. Also, it is used for
1983+
writing <a>NDEF messages</a> to <a>NFC tag</a>s within range.
19841984
</p>
19851985
<pre class="idl">
19861986
typedef (DOMString or BufferSource or NDEFMessageInit) NDEFMessageSource;
@@ -1989,8 +1989,8 @@ <h2>The <dfn>record type</dfn> string</h2>
19891989
interface NDEFReader : EventTarget {
19901990
constructor();
19911991

1992-
attribute EventHandler onerror;
19931992
attribute EventHandler onreading;
1993+
attribute EventHandler onreadingerror;
19941994

19951995
Promise&lt;undefined&gt; scan(optional NDEFScanOptions options={});
19961996
Promise&lt;undefined&gt; write(NDEFMessageSource message,
@@ -2031,10 +2031,6 @@ <h2>The <dfn>record type</dfn> string</h2>
20312031
have one and some tags even create a random number on each read.
20322032
The serial number usually consists of 4 or 7 numbers, separated by `:`.
20332033
</p>
2034-
<p>
2035-
The <dfn>NDEFReader</dfn> is an object used for reading or writing data when
2036-
a device, such as a tag, is within the magnetic induction field.
2037-
</p>
20382034
<p>
20392035
An {{NDEFReader}} object has the following <a data-cite=
20402036
"ECMASCRIPT#sec-object-internal-methods-and-internal-slots">
@@ -2080,7 +2076,7 @@ <h2>The <dfn>record type</dfn> string</h2>
20802076
which is called to notify that new reading is available.
20812077
</p>
20822078
<p>
2083-
The <dfn data-dfn-for="NDEFReader">onerror</dfn> is an {{EventHandler}}
2079+
The <dfn data-dfn-for="NDEFReader">onreadingerror</dfn> is an {{EventHandler}}
20842080
which is called to notify that an error happened during reading.
20852081
</p>
20862082
<section><h3>NFC state associated with the settings object</h3>
@@ -2110,10 +2106,11 @@ <h2>The <dfn>record type</dfn> string</h2>
21102106
</td>
21112107
</tr>
21122108
<tr>
2113-
<td><dfn>[[\ActivatedReaderList]]</dfn></td>
2109+
<td><dfn>[[\PendingRead]]</dfn></td>
21142110
<td>empty <a>set</a></td>
21152111
<td>
2116-
A <a>set</a> of {{NDEFReader}} instances.
2112+
A &lt;|promise:Promise|, |reader:NDEFReader|&gt; tuple where |promise|
2113+
holds a {{Promise}} and |reader| holds an {{NDEFReader}}.
21172114
</td>
21182115
</tr>
21192116
<tr>
@@ -2127,8 +2124,8 @@ <h2>The <dfn>record type</dfn> string</h2>
21272124
</tbody>
21282125
</table>
21292126
<p>
2130-
The <dfn>activated reader objects</dfn> is the value of the
2131-
<a>[[\ActivatedReaderList]]</a> internal slot.
2127+
The <dfn>pending read tuple</dfn> is the value of the
2128+
<a>[[\PendingRead]]</a> internal slot.
21322129
</p>
21332130
<p>
21342131
The <dfn>pending write tuple</dfn> is the value of the
@@ -2271,7 +2268,7 @@ <h2>The <dfn>record type</dfn> string</h2>
22712268
Stop the <a>dispatch NFC content</a> steps.
22722269
</li>
22732270
<li>
2274-
Clear the <a>activated reader objects</a>.
2271+
Clear the <a>pending read tuple</a>.
22752272
</li>
22762273
<li>
22772274
Release the NFC resources associated with |nfc| on the
@@ -3422,9 +3419,9 @@ <h3><dfn>Writing content</dfn></h3>
34223419
accessible to the client.
34233420
</p>
34243421
<p>
3425-
If there are any {{NDEFReader}} instances in <a>activated reader objects</a>
3426-
then the <a>UA</a> MUST listen to <a>NDEF message</a>s on all connected
3427-
NFC adapters.
3422+
If there is a <a>pending read tuple</a> whose |reader| is an
3423+
{{NDEFReader}} instance, then the <a>UA</a> MUST listen to
3424+
<a>NDEF message</a>s on all connected NFC adapters.
34283425
</p>
34293426

34303427
<section> <h3>The <strong>scan()</strong> method</h3>
@@ -3465,12 +3462,10 @@ <h3><dfn>Writing content</dfn></h3>
34653462
abort steps</a> to |reader|.<a>[[\ScanAbortSignal]]</a>:
34663463
<ol>
34673464
<li>
3468-
Remove the {{NDEFReader}} instance from the
3469-
<a>activated reader objects</a>.
3465+
Clear the <a>pending read tuple</a>.
34703466
</li>
34713467
<li>
3472-
If the <a>activated reader objects</a> [= list/is empty =],
3473-
then make a request to stop listening to <a>NDEF message</a>s
3468+
Make a request to stop listening to <a>NDEF message</a>s
34743469
on all <a>NFC adapter</a>s.
34753470
</li>
34763471
</ol>
@@ -3496,7 +3491,7 @@ <h3><dfn>Writing content</dfn></h3>
34963491
and abort these steps.
34973492
</li>
34983493
<li>
3499-
Add |reader| to the <a>activated reader objects</a>.
3494+
Set the <a>pending read tuple</a> to (|p|, |reader|).
35003495
</li>
35013496
<li>
35023497
Resolve |p|.
@@ -3521,14 +3516,10 @@ <h3><dfn>Writing content</dfn></h3>
35213516
If the <a>NFC tag</a> in proximity range does not expose <a>NDEF</a>
35223517
technology for reading or formatting, run the following sub-steps:
35233518
<ol>
3524-
<li>[= list/For each =]
3525-
{{NDEFReader}} instance |reader:NDEFReader| in the
3526-
<a>activated reader objects</a>, run the following sub-steps:
3527-
<ol>
3528-
<li>
3529-
<a>Fire an event</a> named "`error`" at |reader|.
3530-
</li>
3531-
</ol>
3519+
<li>
3520+
If there is a <a>pending read tuple</a> whose |reader| is an
3521+
{{NDEFReader}} instance, fire an event</a> named "`readingerror`" at
3522+
|reader|.
35323523
</li>
35333524
<li>
35343525
Abort these steps.
@@ -3595,16 +3586,11 @@ <h3><dfn>Writing content</dfn></h3>
35953586
</p>
35963587
<ol class=algorithm>
35973588
<li>
3598-
[= list/For each =] {{NDEFReader}} instance |reader:NDEFReader| in
3599-
the <a>activated reader objects</a>,
3600-
<ol>
3601-
<li>
3602-
<a>fire an event</a> named "`reading`" at |reader| using
3603-
<a>NDEFReadingEvent</a> with its <a>serialNumber</a> attribute
3604-
initialized to |serialNumber| and <a>message</a> attribute
3605-
initialized to |message|.
3606-
</li>
3607-
</ol>
3589+
If there is a <a>pending read tuple</a> whose |reader| is an
3590+
{{NDEFReader}} instance, <a>fire an event</a> named "`reading`" at
3591+
|reader| using <a>NDEFReadingEvent</a> with its <a>serialNumber</a>
3592+
attribute initialized to |serialNumber| and <a>message</a> attribute
3593+
initialized to |message|.
36083594
</li>
36093595
</ol>
36103596
</section>

0 commit comments

Comments
 (0)