- From: Mattias Buelens <notifications@github.com>
- Date: Mon, 06 Dec 2021 10:50:10 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 6 December 2021 18:50:22 UTC
I agree about the `.cancel()` name potentially being confusing. It also doesn't help that Streams already has `readableStream.cancel()` and `writableStream.abort()`. 😅 Perhaps `abortController.close()` is better? 🤔 The proposed `.timeout()` method seems quite complex, and I'm not sure if it's sufficiently general to be worth adding to the platform. I think it'd be better if we could first add some more "fundamental" utilities such as `abortController.follow()` (#920) and `abortController.close()`, on top of which you can build `.timeout()`: ```javascript class TimeoutAbortController extends AbortController { #timer; timeout(delay) { if (this.#timer) { this.#timer.close(); // assuming this also cleans up the followed AbortSignal.timeout() signal } this.#timer = new AbortController(); this.#timer.follow(AbortSignal.timeout(delay)); this.follow(this.#timer.signal); } } ``` -- 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/1039#issuecomment-987063228
Received on Monday, 6 December 2021 18:50:22 UTC