From de6de3cae3cefbcdb80afa8054df877030edff4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Fri, 3 Jan 2020 15:05:57 +0100 Subject: [PATCH] Add create steps for absolute-URL records (#512) * Add create steps for absolute URL records * Explicitely set ndef PAYLOAD related fields --- index.html | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 66b9afc..1296895 100644 --- a/index.html +++ b/index.html @@ -2766,7 +2766,13 @@

Writing or pushing content

|ndef|. - +
"`absolute-url`"
+
  • @@ -3363,6 +3369,47 @@

    Writing or pushing content

    + +

    Mapping absolute-URL to NDEF

    +
    + To map absolute-URL to NDEF given a |record:NDEFRecordInit| + and |ndef|, run these steps: +
      +
    1. + If |record|'s mediaType is not `undefined`, + [= exception/throw =] a {{TypeError}} and abort these steps. +
    2. +
    3. + If |record|'s data is not a {{DOMString}}, + [= exception/throw =] a {{TypeError}} and abort these steps. +
    4. +
    5. + If the result of parsing |record|'s + data is failure, [= exception/throw =] a + {{SyntaxError}} and abort these steps. +
    6. +
    7. + Set |arrayBuffer| to |record|'s data. +
    8. +
    9. + Set |data:byte sequence| to |arrayBuffer|.[[\ArrayBufferData]]. +
    10. +
    11. + Set |ndef|'s TNF field to `3` ([=absolute-URL record=]). +
    12. +
    13. + Set |ndef|'s TYPE field to |data|. +
    14. +
    15. + Set |ndef|'s PAYLOAD LENGTH field to `0` and omit PAYLOAD + field. +
    16. +
    17. + Return |ndef|. +
    18. +
    +
    +

    Listening for content