Re: [web-nfc] Consider using AbortController rather than a stop() method (#225)

Maybe nitpicking, but `reader.read()` would give the false idea the script starts an NFC read.

What is useful from NFC point of view is setting up the read and error handlers.
In addition, we set up the AbortController. The name of that setup method should just reflect the fact we are setting up an AbortController. Please suggest another name there :).

On the other hand, I don't see that aborting a read would be a real use case: the user needs to hold the device close to an NFC device, and in the same time cancel the read, or do something else that results in losing focus/visibility that would suspend the read? and script would like to override that with rather canceling than suspending? Sounds a bit fuzzy to me.

IIRC the `start()` and `stop()` methods were added because Sensors compatibility and because setting up event handlers cannot have side effects. But IMHO implementations would be able to handle NFC reads by just having (or not having) event handlers set up for reads with given optional filter. No start() and stop() methods are actually needed IMHO.

But if you have a use case for explicitly aborting an NFC read (from a script), instead of just pulling away the device from the NFC device by the end user, please speak up :). 

Unless we have a compelling use case, could we try shipping without abort support for now and add it later when having use cases?

-- 
GitHub Notification of comment by zolkis
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/225#issuecomment-521560885 using your GitHub account

Received on Thursday, 15 August 2019 08:31:10 UTC