@@ -980,11 +980,11 @@ <h4>
980
980
981
981
< section > < h3 > Feature support</ h3 >
982
982
< 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.
985
985
</ p >
986
986
< pre class ="example ">
987
- if ('NDEFReader' in window) { /* ... Scan or write NDEF Tags */ }
987
+ if ('NDEFReader' in window) { /* ... Scan and write NDEF Tags */ }
988
988
</ pre >
989
989
</ section >
990
990
@@ -1136,13 +1136,13 @@ <h4>
1136
1136
< section > < h3 > Handle scanning errors</ h3 >
1137
1137
< p >
1138
1138
This example shows what happens when {{NDEFReader/scan}} promise rejects and
1139
- {{NDEFReader/onerror }} is fired.
1139
+ {{NDEFReader/onreadingerror }} is fired.
1140
1140
</ p >
1141
1141
< pre class ="example ">
1142
1142
const ndef = new NDEFReader();
1143
1143
ndef.scan().then(() => {
1144
1144
console.log("Scan started successfully.");
1145
- ndef.onerror = event => {
1145
+ ndef.onreadingerror = event => {
1146
1146
console.log("Error! Cannot read data from the NFC tag. Try a different one?");
1147
1147
};
1148
1148
ndef.onreading = event => {
@@ -1978,9 +1978,9 @@ <h2>The <dfn>record type</dfn> string</h2>
1978
1978
< section > < h2 > The NDEFReader object</ h2 >
1979
1979
< p >
1980
1980
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.
1984
1984
</ p >
1985
1985
< pre class ="idl ">
1986
1986
typedef (DOMString or BufferSource or NDEFMessageInit) NDEFMessageSource;
@@ -1989,8 +1989,8 @@ <h2>The <dfn>record type</dfn> string</h2>
1989
1989
interface NDEFReader : EventTarget {
1990
1990
constructor();
1991
1991
1992
- attribute EventHandler onerror;
1993
1992
attribute EventHandler onreading;
1993
+ attribute EventHandler onreadingerror;
1994
1994
1995
1995
Promise<undefined> scan(optional NDEFScanOptions options={});
1996
1996
Promise<undefined> write(NDEFMessageSource message,
@@ -2031,10 +2031,6 @@ <h2>The <dfn>record type</dfn> string</h2>
2031
2031
have one and some tags even create a random number on each read.
2032
2032
The serial number usually consists of 4 or 7 numbers, separated by `:`.
2033
2033
</ 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 >
2038
2034
< p >
2039
2035
An {{NDEFReader}} object has the following < a data-cite =
2040
2036
"ECMASCRIPT#sec-object-internal-methods-and-internal-slots ">
@@ -2080,7 +2076,7 @@ <h2>The <dfn>record type</dfn> string</h2>
2080
2076
which is called to notify that new reading is available.
2081
2077
</ p >
2082
2078
< 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}}
2084
2080
which is called to notify that an error happened during reading.
2085
2081
</ p >
2086
2082
< section > < h3 > NFC state associated with the settings object</ h3 >
@@ -2110,10 +2106,11 @@ <h2>The <dfn>record type</dfn> string</h2>
2110
2106
</ td >
2111
2107
</ tr >
2112
2108
< tr >
2113
- < td > < dfn > [[\ActivatedReaderList ]]</ dfn > </ td >
2109
+ < td > < dfn > [[\PendingRead ]]</ dfn > </ td >
2114
2110
< td > empty < a > set</ a > </ td >
2115
2111
< td >
2116
- A < a > set</ a > of {{NDEFReader}} instances.
2112
+ A <|promise:Promise|, |reader:NDEFReader|> tuple where |promise|
2113
+ holds a {{Promise}} and |reader| holds an {{NDEFReader}}.
2117
2114
</ td >
2118
2115
</ tr >
2119
2116
< tr >
@@ -2127,8 +2124,8 @@ <h2>The <dfn>record type</dfn> string</h2>
2127
2124
</ tbody >
2128
2125
</ table >
2129
2126
< 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.
2132
2129
</ p >
2133
2130
< p >
2134
2131
The < dfn > pending write tuple</ dfn > is the value of the
@@ -2271,7 +2268,7 @@ <h2>The <dfn>record type</dfn> string</h2>
2271
2268
Stop the < a > dispatch NFC content</ a > steps.
2272
2269
</ li >
2273
2270
< li >
2274
- Clear the < a > activated reader objects </ a > .
2271
+ Clear the < a > pending read tuple </ a > .
2275
2272
</ li >
2276
2273
< li >
2277
2274
Release the NFC resources associated with |nfc| on the
@@ -3422,9 +3419,9 @@ <h3><dfn>Writing content</dfn></h3>
3422
3419
accessible to the client.
3423
3420
</ p >
3424
3421
< 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.
3428
3425
</ p >
3429
3426
3430
3427
< section > < h3 > The < strong > scan()</ strong > method</ h3 >
@@ -3465,12 +3462,10 @@ <h3><dfn>Writing content</dfn></h3>
3465
3462
abort steps</ a > to |reader|.< a > [[\ScanAbortSignal]]</ a > :
3466
3463
< ol >
3467
3464
< li >
3468
- Remove the {{NDEFReader}} instance from the
3469
- < a > activated reader objects</ a > .
3465
+ Clear the < a > pending read tuple</ a > .
3470
3466
</ li >
3471
3467
< 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
3474
3469
on all < a > NFC adapter</ a > s.
3475
3470
</ li >
3476
3471
</ ol >
@@ -3496,7 +3491,7 @@ <h3><dfn>Writing content</dfn></h3>
3496
3491
and abort these steps.
3497
3492
</ li >
3498
3493
< li >
3499
- Add |reader| to the < a > activated reader objects </ a > .
3494
+ Set the < a > pending read tuple </ a > to (|p|, |reader|) .
3500
3495
</ li >
3501
3496
< li >
3502
3497
Resolve |p|.
@@ -3521,14 +3516,10 @@ <h3><dfn>Writing content</dfn></h3>
3521
3516
If the < a > NFC tag</ a > in proximity range does not expose < a > NDEF</ a >
3522
3517
technology for reading or formatting, run the following sub-steps:
3523
3518
< 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|.
3532
3523
</ li >
3533
3524
< li >
3534
3525
Abort these steps.
@@ -3595,16 +3586,11 @@ <h3><dfn>Writing content</dfn></h3>
3595
3586
</ p >
3596
3587
< ol class =algorithm >
3597
3588
< 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|.
3608
3594
</ li >
3609
3595
</ ol >
3610
3596
</ section >
0 commit comments