- From: Zoltan Kis via GitHub <sysbot+gh@w3.org>
- Date: Wed, 14 Oct 2020 08:00:14 +0000
- To: public-web-nfc@w3.org
Alternative [Example 6](https://w3c.github.io/web-nfc/#example-6).
```javascript
navigator.nfc.scan().then(() => {
console.log("Scan started successfully.");
navigator.nfc.onerror = event => {
console.log("Error! Cannot read data from the NFC tag. Try a different one?");
};
navigator.nfc.ontagfound = event => {
let message = await event.ndef.read();
console.log("NDEF message read.");
};
}).catch(error => {
console.log(`Error! Scan failed to start: ${error}.`);
});
```
--
GitHub Notification of comment by zolkis
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/602#issuecomment-708231845 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 14 October 2020 08:00:17 UTC