Skip to content

Commit 59624e0

Browse files
authored
Merge pull request #611 from zolkis/fix-multiple-scanners
Fix #592: allow multiple readers but no multiple scans on any reader
2 parents dfb8400 + 341f824 commit 59624e0

File tree

1 file changed

+48
-46
lines changed

1 file changed

+48
-46
lines changed

index.html

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,11 +2079,10 @@ <h2>The <dfn>record type</dfn> string</h2>
20792079
</td>
20802080
</tr>
20812081
<tr>
2082-
<td><dfn>[[\PendingRead]]</dfn></td>
2082+
<td><dfn>[[\ActivatedReaderList]]</dfn></td>
20832083
<td>empty <a>set</a></td>
20842084
<td>
2085-
A &lt;|promise:Promise|, |reader:NDEFReader|&gt; tuple where |promise|
2086-
holds a {{Promise}} and |reader| holds an {{NDEFReader}}.
2085+
A <a>set</a> of {{NDEFReader}} instances.
20872086
</td>
20882087
</tr>
20892088
<tr>
@@ -2097,8 +2096,8 @@ <h2>The <dfn>record type</dfn> string</h2>
20972096
</tbody>
20982097
</table>
20992098
<p>
2100-
The <dfn>pending read tuple</dfn> is the value of the
2101-
<a>[[\PendingRead]]</a> internal slot.
2099+
The <dfn>activated reader objects</dfn> is the value of the
2100+
<a>[[\ActivatedReaderList]]</a> internal slot.
21022101
</p>
21032102
<p>
21042103
The <dfn>pending write tuple</dfn> is the value of the
@@ -2204,8 +2203,8 @@ <h2>The <dfn>record type</dfn> string</h2>
22042203

22052204
<section><h3>Aborting pending write operation</h3>
22062205
<div>
2207-
To attempt to <dfn>abort a pending write operation</dfn> on an
2208-
<a>environment settings object</a>, perform the following steps:
2206+
To attempt to <dfn>abort a pending write operation</dfn>,
2207+
run the following steps:
22092208
<ol class=algorithm>
22102209
<li>
22112210
If there is no <a>pending write tuple</a> |tuple|, abort these steps.
@@ -2238,14 +2237,10 @@ <h2>The <dfn>record type</dfn> string</h2>
22382237
Attempt to <a>abort a pending write operation</a>.
22392238
</li>
22402239
<li>
2241-
Stop the <a>dispatch NFC content</a> steps.
2240+
Clear the <a>activated reader objects</a>.
22422241
</li>
22432242
<li>
2244-
Clear the <a>pending read tuple</a>.
2245-
</li>
2246-
<li>
2247-
Release the NFC resources associated with |nfc| on the
2248-
underlying platform.
2243+
Release the NFC resources on the underlying platform.
22492244
</li>
22502245
</ol>
22512246
<p>
@@ -2510,7 +2505,7 @@ <h3><dfn>Writing content</dfn></h3>
25102505
Let |records| be the list « |textRecord| ».
25112506
</li>
25122507
<li>
2513-
Set |source|'s <a>records</a> to |records|.
2508+
Set |source|'s records to |records|.
25142509
</li>
25152510
</ul>
25162511
<dt>{{BufferSource}}</dt>
@@ -2524,13 +2519,13 @@ <h3><dfn>Writing content</dfn></h3>
25242519
Let |records| be the list « |mimeRecord| ».
25252520
</li>
25262521
<li>
2527-
Set |source|'s <a>records</a> to |records|.
2522+
Set |source|'s records to |records|.
25282523
</li>
25292524
</ul>
25302525
<dt>{{NDEFMessageInit}}</dt>
25312526
<ul>
25322527
<li>
2533-
If |source|'s <a>records</a> [= list/is empty =], [= exception/throw =]
2528+
If |source|'s records [= list/is empty =], [= exception/throw =]
25342529
a {{TypeError}} and abort these steps.
25352530
</li>
25362531
</ul>
@@ -2548,7 +2543,7 @@ <h3><dfn>Writing content</dfn></h3>
25482543
</li>
25492544
<li>
25502545
[= list/For each =] |record:NDEFRecordInit| in the <a>list</a>
2551-
|source|'s <a>records</a>, run the following steps:
2546+
|source|'s records, run the following steps:
25522547
<ol>
25532548
<li>
25542549
Let |ndef| be the result of running <a>create NDEF record</a>
@@ -3397,9 +3392,9 @@ <h3><dfn>Writing content</dfn></h3>
33973392
accessible to the client.
33983393
</p>
33993394
<p>
3400-
If there is a <a>pending read tuple</a> whose |reader| is an
3401-
{{NDEFReader}} instance, then the <a>UA</a> MUST listen to
3402-
<a>NDEF message</a>s on all connected NFC adapters.
3395+
If there are any {{NDEFReader}} instances in <a>activated reader objects</a>
3396+
then the <a>UA</a> MUST listen to <a>NDEF message</a>s on all connected
3397+
NFC adapters.
34033398
</p>
34043399

34053400
<section> <h3>The <strong>scan()</strong> method</h3>
@@ -3416,7 +3411,7 @@ <h3><dfn>Writing content</dfn></h3>
34163411
</li>
34173412
<li>
34183413
If not currently executing in the currently active <a>top-level
3419-
browsing context</a>, then reject |p| with and
3414+
browsing context</a>, then reject |p| with an
34203415
{{"InvalidStateError"}} {{DOMException}} and return |p|.
34213416
</li>
34223417
<li>
@@ -3436,23 +3431,16 @@ <h3><dfn>Writing content</dfn></h3>
34363431
<li>
34373432
If |signal| is not `null`, then
34383433
<a data-cite="dom#abortsignal-abort-algorithms">
3439-
add the following abort steps</a> to |signal|:
3440-
<ol>
3441-
<li>
3442-
Clear the <a>pending read tuple</a> .
3443-
</li>
3444-
<li>
3445-
Make a request to stop listening to <a>NDEF message</a>s
3446-
on all <a>NFC adapter</a>s.
3447-
</li>
3448-
</ol>
3449-
</li>
3450-
<li>
3451-
[=promise/React=] to |p|:
3434+
add the following <dfn>clean up the pending scan</dfn> steps</a>
3435+
to |signal|:
34523436
<ol>
34533437
<li>
3454-
If |p| was settled (fulfilled or rejected), then clear the
3455-
<a>pending read tuple</a>.
3438+
Remove |reader| from the <a>activated reader objects</a>.
3439+
</li>
3440+
<li>
3441+
If the <a>activated reader objects</a> [= list/is empty =],
3442+
then make a request to stop listening to <a>NDEF message</a>s
3443+
on all <a>NFC adapter</a>s.
34563444
</li>
34573445
</ol>
34583446
</li>
@@ -3477,7 +3465,12 @@ <h3><dfn>Writing content</dfn></h3>
34773465
and abort these steps.
34783466
</li>
34793467
<li>
3480-
Set the <a>pending read tuple</a> to (|p|, |reader|).
3468+
If |reader| is already in the <a>activated reader objects</a>,
3469+
then reject |p| with an {{"InvalidStateError"}} {{DOMException}}
3470+
and abort these steps.
3471+
</li>
3472+
<li>
3473+
Add |reader| to the <a>activated reader objects</a>.
34813474
</li>
34823475
<li>
34833476
Resolve |p|.
@@ -3502,10 +3495,14 @@ <h3><dfn>Writing content</dfn></h3>
35023495
If the <a>NFC tag</a> in proximity range does not expose <a>NDEF</a>
35033496
technology for reading or formatting, run the following sub-steps:
35043497
<ol>
3505-
<li>
3506-
If there is a <a>pending read tuple</a> whose |reader| is an
3507-
{{NDEFReader}} instance, fire an event</a> named "`readingerror`" at
3508-
|reader|.
3498+
<li>[= list/For each =]
3499+
{{NDEFReader}} instance |reader:NDEFReader| in the
3500+
<a>activated reader objects</a>, run the following sub-steps:
3501+
<ol>
3502+
<li>
3503+
<a>Fire an event</a> named "`error`" at |reader|.
3504+
</li>
3505+
</ol>
35093506
</li>
35103507
<li>
35113508
Abort these steps.
@@ -3572,11 +3569,16 @@ <h3><dfn>Writing content</dfn></h3>
35723569
</p>
35733570
<ol class=algorithm>
35743571
<li>
3575-
If there is a <a>pending read tuple</a> whose |reader| is an
3576-
{{NDEFReader}} instance, <a>fire an event</a> named "`reading`" at
3577-
|reader| using <a>NDEFReadingEvent</a> with its <a>serialNumber</a>
3578-
attribute initialized to |serialNumber| and <a>message</a> attribute
3579-
initialized to |message|.
3572+
[= list/For each =] {{NDEFReader}} instance |reader:NDEFReader| in
3573+
the <a>activated reader objects</a>,
3574+
<ol>
3575+
<li>
3576+
<a>fire an event</a> named "`reading`" at |reader| using
3577+
<a>NDEFReadingEvent</a> with its <a>serialNumber</a> attribute
3578+
initialized to |serialNumber| and its <a>message</a> attribute
3579+
initialized to |message|.
3580+
</li>
3581+
</ol>
35803582
</li>
35813583
</ol>
35823584
</section>

0 commit comments

Comments
 (0)