You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hope this question is not off-topic here and I must admit that I am not used to async/await thinking in JS (not my primary language).
I'd like to to a "batch read" of NFC tags on iOS. That is, after a tag has been successfully read, immediately start the next nfc.scanTag() session, until there is an error (including user aborts).
What I have been trying looks like this:
functionscanTags(){nfc.scanTag().then(function(tag){if(tag.id){// do something with tag datascanTags();}},function(err){console.log(err);});}
This does, however, not work. Here's what happens:
To me it looks as if the tagReaderSession is still active handling the first tag (invoking my callback function), and I cannot enter another session from there.
This seems very understandable to me – the question, however, is: What is the right pattern/paradigm to solve this?
I could probably do something with timeouts and invoke scanTags() again one or two seconds after my callback has been invoked, but that seems rather clumsy.
I'd appreciate any tips or starting pointers. Thanks!
The text was updated successfully, but these errors were encountered:
Hello everyone,
I hope this question is not off-topic here and I must admit that I am not used to async/await thinking in JS (not my primary language).
I'd like to to a "batch read" of NFC tags on iOS. That is, after a tag has been successfully read, immediately start the next
nfc.scanTag()
session, until there is an error (including user aborts).What I have been trying looks like this:
This does, however, not work. Here's what happens:
To me it looks as if the tagReaderSession is still active handling the first tag (invoking my callback function), and I cannot enter another session from there.
This seems very understandable to me – the question, however, is: What is the right pattern/paradigm to solve this?
I could probably do something with timeouts and invoke
scanTags()
again one or two seconds after my callback has been invoked, but that seems rather clumsy.I'd appreciate any tips or starting pointers. Thanks!
The text was updated successfully, but these errors were encountered: