Re: [whatwg/dom] Add AbortSignal.timeout(ms) (#951)

@keithamus Interesting! I think we could do that by combining with `AbortController.follow()` from #920:
```javascript
async function handleRequest(signal) {
  const dbController = new AbortController();
  dbController.follow(signal);
  dbController.follow(AbortSignal.timeout(2_000));
  await readFromDatabase(dbController.signal);
}

await handleRequest(AbortSignal.timeout(10_000));
```
The `readFromDatabase()` call will be aborted after either the parent request's deadline has passed, or the 2-second deadline has passed (whichever happens first).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/951#issuecomment-785495590

Received on Thursday, 25 February 2021 00:54:19 UTC