From 4aafd69859f1da550950a4e2468f9aa5ac4b8d23 Mon Sep 17 00:00:00 2001 From: Zoltan Kis Date: Wed, 23 Sep 2020 21:39:19 +0300 Subject: [PATCH] Rename onerror to onreaderror. Replace activated reader list with pending read tuple. Signed-off-by: Zoltan Kis --- index.html | 60 +++++++++++++++++++++++------------------------------- 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/index.html b/index.html index 6be9b1e..92d1d5a 100644 --- a/index.html +++ b/index.html @@ -1135,13 +1135,13 @@

Handle scanning errors

This example shows what happens when {{NDEFReader/scan}} promise rejects and - {{NDEFReader/onerror}} is fired. + {{NDEFReader/onreadingerror}} is fired.

       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 => {
@@ -1988,7 +1988,7 @@ 

The record type string

interface NDEFReader : EventTarget { constructor(); - attribute EventHandler onerror; + attribute EventHandler onreadingerror; attribute EventHandler onreading; Promise<undefined> scan(optional NDEFScanOptions options={}); @@ -2079,7 +2079,7 @@

The record type string

which is called to notify that new reading is available.

- The onerror is an {{EventHandler}} + The onreadingerror is an {{EventHandler}} which is called to notify that an error happened during reading.

NFC state associated with the settings object

@@ -2109,10 +2109,11 @@

The record type string

- [[\ActivatedReaderList]] + [[\PendingRead]] empty set - A set of {{NDEFReader}} instances. + A <|promise:Promise|, |reader:NDEFReader|> tuple where |promise| + holds a {{Promise}} and |reader| holds an {{NDEFReader}}. @@ -2126,8 +2127,8 @@

The record type string

- The activated reader objects is the value of the - [[\ActivatedReaderList]] internal slot. + The pending read tuple is the value of the + [[\PendingRead]] internal slot.

The pending write tuple is the value of the @@ -2270,7 +2271,7 @@

The record type string

Stop the dispatch NFC content steps.
  • - Clear the activated reader objects. + Clear the pending read tuple.
  • Release the NFC resources associated with |nfc| on the @@ -3421,9 +3422,9 @@

    Writing content

    accessible to the client.

    - If there are any {{NDEFReader}} instances in activated reader objects - then the UA MUST listen to NDEF messages on all connected - NFC adapters. + If there is a pending read tuple whose |reader| is an + {{NDEFReader}} instance, then the UA MUST listen to + NDEF messages on all connected NFC adapters.

    The scan() method

    @@ -3464,12 +3465,10 @@

    Writing content

    abort steps to |reader|.[[\ScanAbortSignal]]:
    1. - Remove the {{NDEFReader}} instance from the - activated reader objects. + Clear the pending read tuple.
    2. - If the activated reader objects [= list/is empty =], - then make a request to stop listening to NDEF messages + Make a request to stop listening to NDEF messages on all NFC adapters.
    @@ -3495,7 +3494,7 @@

    Writing content

    and abort these steps.
  • - Add |reader| to the activated reader objects. + Set the pending read tuple to (|p|, |reader|).
  • Resolve |p|. @@ -3520,14 +3519,10 @@

    Writing content

    If the NFC tag in proximity range does not expose NDEF technology for reading or formatting, run the following sub-steps:
      -
    1. [= list/For each =] - {{NDEFReader}} instance |reader:NDEFReader| in the - activated reader objects, run the following sub-steps: -
        -
      1. - Fire an event named "`error`" at |reader|. -
      2. -
      +
    2. + If there is a pending read tuple whose |reader| is an + {{NDEFReader}} instance, fire an event named "`readingerror`" at + |reader|.
    3. Abort these steps. @@ -3594,16 +3589,11 @@

      Writing content

      1. - [= list/For each =] {{NDEFReader}} instance |reader:NDEFReader| in - the activated reader objects, -
          -
        1. - fire an event named "`reading`" at |reader| using - NDEFReadingEvent with its serialNumber attribute - initialized to |serialNumber| and message attribute - initialized to |message|. -
        2. -
        + If there is a pending read tuple whose |reader| is an + {{NDEFReader}} instance, fire an event named "`reading`" at + |reader| using NDEFReadingEvent with its serialNumber + attribute initialized to |serialNumber| and message attribute + initialized to |message|.