- From: François Beaufort via GitHub <sysbot+gh@w3.org>
- Date: Tue, 04 Apr 2023 12:01:24 +0000
- To: public-web-nfc@w3.org
beaufortfrancois has just created a new issue for https://github.com/w3c/web-nfc: == Read NFC tag after writing to it == It is currently cumbersome to read records from an NFC tag after writing to it as the user must tap the NFC tag one first time to write to it, then make it out of range so that they can tap it again to read records. To help with that journey, I was thinking we could perform a read NFC operation after a write NFC operation and return the `NDEFMessage` when the `NDEFReader.write()` promise resolves if web developers expressed it via an `NDEFWriteOptions` option. ```js // Waiting for user to tap NFC tag... const ndef = new NDEFReader(); await ndef.scan(); // Write and read NFC tag. const message = await ndef.write("Hello world", { readAfter: true }); // <-- NEW! console.log(message); ``` Note that by setting the `readAfter` default value to `false`, the current behavior does not change for existing web apps using `NDEFReader.write()` today. ```webidl interface NDEFReader : EventTarget { ... Promise<NDEFMessage?> write(NDEFMessageSource message, optional NDEFWriteOptions options={}); }; partial dictionary NDEFWriteOptions { boolean readAfter = false; }; ``` Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/654 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 4 April 2023 12:01:26 UTC