diff --git a/index.html b/index.html index 01fe5c1..bb36bca 100644 --- a/index.html +++ b/index.html @@ -730,7 +730,7 @@ class="example">

Filtering of relevant data sources can be done by the use of - the NFCWatchOptions. Below we accept URL with + the NFCReaderOptions. Below we accept URL with "/mypath/mygame/" in its path from "mygame.com" domain and its subdomains. When we read the data, we immediately update the game progress by issueing a push with a custom NDEF data layout. @@ -1430,10 +1430,11 @@

The NFCRecordType enum

Promise<void> push(NFCMessageSource message, optional NFCPushOptions options); }; - [Constructor(), SecureContext, Exposed=Window] + [Constructor(optional NFCReaderOptions options), SecureContext, Exposed=Window] interface NFCReader : EventTarget { - Promise<void> watch(optional NFCWatchOptions options); attribute EventHandler onreading; + + Promise<void> watch(); }; [Constructor(DOMString type, NFCReadingEventInit nfcReadingEventInitDict), SecureContext, Exposed=Window] @@ -1678,28 +1679,28 @@

The NFCPushTarget enum

-

The NFCWatchOptions dictionary

+

The NFCReaderOptions dictionary

To describe which messages an application is interested in, the - NFCWatchOptions dictionary is used: + NFCReaderOptions dictionary is used:

-        dictionary NFCWatchOptions {
+        dictionary NFCReaderOptions {
           USVString url = "";
           NFCRecordType recordType;
           USVString mediaType = "";
-          NFCWatchMode mode = "web-nfc-only";
+          NFCAccept accept = "web-nfc-only";
           AbortSignal? signal;
         };
       

- The NFCWatchOptions.url property + The NFCReaderOptions.url property denotes the URL pattern which is used for matching the Web NFC Id of Web NFC messages which are being read. The default value "" means that no matching happens.

- The NFCWatchOptions.recordType property + The NFCReaderOptions.recordType property denotes the enum value which is used for matching the recordType property of each @@ -1708,19 +1709,19 @@

The NFCPushTarget enum

NFC watch algorithm.

- The NFCWatchOptions.mediaType property + The NFCReaderOptions.mediaType property denotes the match pattern which is used for matching the mediaType property of each NFCRecord object in a Web NFC message. The default value "" means that no matching happens.

- The NFCWatchOptions.mode property denotes the - NFCWatchMode value telling whether only + The NFCReaderOptions.accept property denotes the + NFCAccept value telling whether only Web NFC content or any NFC content will be watched.

- The NFCWatchOptions.signal property allows to abort + The NFCReaderOptions.signal property allows to abort the watch.

@@ -1742,10 +1743,10 @@

The NFCPushTarget enum

mediaType: "application/octet-stream" } -
+
-
-

The NFCWatchMode enum

+
+

The NFCAccept enum

This enum defines the set of known values denoting whether watch() operation should @@ -1753,7 +1754,7 @@

The NFCWatchMode enum

NFC content

-      enum NFCWatchMode {
+      enum NFCAccept {
         "web-nfc-only",
         "any"
       };
@@ -1771,7 +1772,48 @@ 

The NFCWatchMode enum

are dispatched. -
+
+ +

Constructing an NFCReader object

+

+

    +
  1. + Let reader be a new NFCReader object. +
  2. +
  3. + Let options be first argument to constructor. +
  4. +
  5. + For each keyvalue of options: +
      +
    • + If key equals "url", set + reader.[[\Url]] to value. +
    • +
    • + Otherwise, if key equals "recordType", set + reader.[[\RecordType]] to value. +
    • +
    • + Otherwise, if key equals "mediaType", set + reader.[[\MediaType]] to value. +
    • +
    • + Otherwise, if key equals "accept", set + reader.[[\Accept]] to value. +
    • +
    • + Otherwise, if key equals "signal", set + reader.[[\Signal]] to value. +
    • +
    +
  6. +
  7. + Return reader. +
  8. +
+

+

Writing or pushing content

@@ -2632,8 +2674,8 @@

The NFCWatchMode enum

URL patterns used in NFC watches.

- An NFC watch is referring to a tuple of a Promise, - and a NFCWatchOptions dictionary. + An NFC watch refers to a tuple of a Promise, + and an NFCReader instance.

The section @@ -2656,11 +2698,8 @@

The NFCWatchMode enum

Let reader_instance be the NFCReader instance.
  • - Let options be the first argument. -
  • -
  • - Let signal be the options’ dictionary member of the same - name if present, or null otherwise. + Let signal be reader_instance.[[\Signal]] + if present, or null otherwise.
  • If signal’s aborted flag is set, then reject p @@ -2672,7 +2711,7 @@

    The NFCWatchMode enum

    p with "NotSupportedError" and return p.
  • - Add p, options, and reader_instance + Add p and reader_instance together as an NFC watch to the incumbent NFC watch list.
  • @@ -2710,7 +2749,7 @@

    The NFCWatchMode enum

    "NotSupportedError" and return p.
  • - If the options.url is not an empty String + If the reader_instance.[[\Url]] is not an empty String and it is not a valid URL pattern, throw "SyntaxError" exception and return p.
  • @@ -2755,7 +2794,7 @@

    The NFCWatchMode enum

    In this step UAs are advised to notify users about that reading NFC content may indirectly reveal the physical location of the user. In addition, if "any" - NFCWatchMode is used, then also include in this + NFCAccept is used, then also include in this information that the origin is requesting to read not only NFC content meant for web pages, but any NFC content.

    @@ -2974,39 +3013,36 @@

    Receiving and parsing content

    the watch was registered on.
  • - Let options be the NFCWatchOptions - saved with watch. -
  • -
  • - If options.mode is "web-nfc-only" and + If reader_instance.[[\Accept]] is "web-nfc-only" and message.url is null, skip to the next NFC watch.
  • - Otherwise, if options.mode is "any", - set options.url to "". + Otherwise, if reader_instance.[[\Accept]] is "any", + set reader_instance.[[\Url]] to "".
  • - If the URL pattern options.url is not + If the URL pattern reader_instance.[[\Url]] is not an empty String invoke URL pattern match - algorithm, providing options.url as a URL pattern and + algorithm, providing reader_instance.[[\Url]] as a + URL pattern and message.url as a Web NFC Id. If URL pattern match algorithm returns false, skip to the next NFC watch.
  • - If options.recordType is present and - it is not equal to any record.recordType where record + If reader_instance.[[\RecordType]] is present and + it is not equal to any record.[[\RecordType]] where record is an element of message, skip to the next NFC watch.
  • - If options.mediaType is not "" and it is not - equal to any record.mediaType where record is + If reader_instance.[[\MediaType]] is not "" and + it is not equal to any record.mediaType where record is an element of message, skip to the next NFC watch.
  • - Fire an event named "reading" at reader_instance + Fire an event named "reading" at reader_instance using NFCReadingEvent with its message attribute initialized to message.
  • @@ -3112,6 +3148,9 @@

  • append
  • +
  • + contains +
  • [[!DOM]] defines the following terms: