Follow up on https://esdiscuss.org/topic/promise-returning-delay-function
I think we really need that function, with AbortController support
We could do things like
```js
const abortFetch = new AbortController();
const abortTimeout = new AbortController();
await Promise.race([
Promise.delay(5000, {signal: abortTimeout.signal}),
fetch(url, {signal: abortFetch.signal}).then(r => r.json()).then(...),
])
.finally(() => {
abortFetch.abort();
abortTimeout.abort(); // avoid mem leaks, that would call clearTimeout
under the hood
})
```
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss