- From: François Beaufort via GitHub <sysbot+gh@w3.org>
- Date: Mon, 28 Oct 2019 09:52:15 +0000
- To: public-web-nfc@w3.org
beaufortfrancois has just created a new issue for https://github.com/w3c/web-nfc:
== Remove NDEFPushOptions timeout ==
The NDEFPushOptions `timeout` seems like it could be replaced with a simple timeout and NDEFPushOptions `signal` as you can see below.
Maybe there's more to it, but if not, shall we simply remove it?
```js
const writer = new NDEFWriter();
writer.push('hello world', { timeout: 5000 });
.catch(e => {
if (e.name === 'TimeoutError') {
// Push operation timed out.
}
});
```
and its equivalent
```js
const writer = new NDEFWriter();
const controller = new AbortController();
setTimeout(() => controller.abort(), 5000);
writer.push('hello world', { signal: controller.signal });
.catch(e => {
if (e.name === 'AbortError') {
// Push operation has been aborted.
}
});
```
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/418 using your GitHub account
Received on Monday, 28 October 2019 09:52:17 UTC