- From: joshdillner via GitHub <sysbot+gh@w3.org>
- Date: Fri, 15 Nov 2019 01:08:22 +0000
- To: public-web-nfc@w3.org
joshdillner has just created a new issue for https://github.com/w3c/web-nfc:
== Can't read empty tags ==
Hi, I've been implementing the latest API and testing on Chrome Canary, and I've found that I can't scan empty tags - it never enters the "onreading" or "onerror" event.
I've also found that writing a url record type seems to add 2 records:
Record 0, type = URI record
Record 1, type = w3.org:a
Can you advise? Here's my code:
(async () => {
this.setState({error: {message: 'ready to scan'}});
await reader.scan({ signal: controller.signal });
reader.onreading = event => {
this.setState({error: {message: 'found tag, starting write'}});
const writer = new NDEFWriter();
writer.push({
records: [{
recordType: 'url',
data: `https://www.google.com`
}]
}).then(() => {
this.setState({writing: false, writeResult: 'success', error: {message: 'write success'}});
controller.abort();
}).catch(e => {
this.setState({writing: false, writeResult: 'fail', error: {...e, message: 'writing failed, try again'}});
controller.abort();
});
}
reader.onerror = event => {
this.setState({error: {message: 'scanning error'}});
}
})();
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/442 using your GitHub account
Received on Friday, 15 November 2019 01:08:24 UTC