Hacker News new | ask | show | jobs
by magma17 2294 days ago
I mean, if the nfc event is triggered, this code

for (i=0, i<10, i++) writer.write(i)

does it write ten times the tag? overwriting every number?

1 comments

The NDEFWriter write()-method currently returns a promise which is resolved on a successful write operation and rejected on a failed write operation, so you would need to use async-await to be able to loop those writes like that. Here is a reference to the Web NFC API Write-operation: https://w3c.github.io/web-nfc/#writing-to-an-nfc-tag