2 ms·
can you write a tag multiple times with one interaction?
by magma17 7y ago
can you write a tag multiple times with one interaction?
- codemysoul 7y agoDepends on what you mean with an interaction. Technically it would be possible to stack write operations, so you could just keep a tag to a close proximity of the adapter, and keep writing messages one after another. With the webnfc.app, you can only write a single NDEF message with single record of either URL or Text, during single interaction.
- magma17 7y agoI 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?
- codemysoul 7y agoThe 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 https://w3c.github.io/web-nfc/#writing-to-an-nfc-tag