W3C home > Mailing lists > Public > public-web-nfc@w3.org > July 2020

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

From: François Beaufort via GitHub <sysbot+gh@w3.org>
Date: Fri, 10 Jul 2020 10:13:34 +0000
To: public-web-nfc@w3.org
Message-ID: <issue_comment.created-656599427-1594376012-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Friday, 10 July 2020 10:13:38 UTC