- From: James M Snell <notifications@github.com>
- Date: Fri, 01 Jul 2022 08:12:07 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 1 July 2022 15:12:19 UTC
I think having a simple `TimeoutAbortController` type would be nice, but not critical.
```js
class TimeoutAbortController extends AbortController { /* ... */ }
auto controller = new TimeoutAbortController(10 * 1000);
useSignalSomewhere(controller.signal);
// Call reset() to reset the timer.
controller.reset();
// TimeoutAbortController extends from AbortController, so still possible to call abort() directly.
controller.abort();
```
This would simplify some of the cases motivating the `AbortSignal.any()` discussion also, as the `signal` from a `TimeoutAbortController` could be triggered in two ways: either by the timeout or by explicitly calling `abort()`.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1082#issuecomment-1172450060
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/issues/1082/1172450060@github.com>
Received on Friday, 1 July 2022 15:12:19 UTC