Re: [web-nfc] Decide whether multiple scanners are allowed (#592)

I'm looking at other APIs and how they deal with multiple operations with an AbortSignal.

The Idle Detection API doesn't allow starting a second time when it's already started
```
Uncaught DOMException: Failed to execute 'start' on 'IdleDetector': Idle detector is already started.
```

Something similar happens for Web Bluetooth and `watchAdvertisements`
```
Failed to execute 'watchAdvertisements' on 'BluetoothDevice': Pending watch advertisements operation.
```

So we could simply reject scan promise when there's already an ongoing scan. WDYT?

```js
const reader = new NDEFReader();
await reader.scan();
reader.scan(); // <- rejects immediately with InvalidStateError 

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

Received on Friday, 10 July 2020 10:13:37 UTC