w3c / web-nfc

Web NFC
https://w3c.github.io/web-nfc/
Other
309 stars 68 forks source link

Should NFCReader scan() method throw an AbortError ? #311

Closed riju closed 5 years ago

riju commented 5 years ago

Scan method Step

  1. If reader.[[Signal]]’s aborted flag is set, then return.

Do we want to throw an AbortError ? like the push() Step 7.

zolkis commented 5 years ago

No, the recommendation is the current text: https://dom.spec.whatwg.org/#abortsignal-aborted-flag

This condition happens when the script aborts the scan. Then we don't need to also throw IMHO, but YMMV.

zolkis commented 5 years ago

Actually what we need to do IMHO is clean up the spec about aborting a push. We need to define aborting a push with the same prose as aborting a scan, and define push cleanup steps for what is aborting a push steps now.

The scan seems OK for me since you get an event onabort and that's enough for a script.

reillyeon commented 5 years ago

Using the AbortController is the only way to stop a scan and isn't an exceptional case so I don't think we need to dispatch an error on abort.

riju commented 5 years ago

Thanks @reillyeon and @zolkis, closing this.