- From: James M Snell <notifications@github.com>
- Date: Mon, 06 Dec 2021 11:28:15 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 6 December 2021 19:28:28 UTC
`close()` definitely works over `cancel()`
And I could get on board with `follow` with the exception that it's not much better/different than simply attaching an event listener to the signal.
```js
class TimeoutAbortController extends AbortController {
#timer;
static #abort() { this.abort(this.#timer.reason); }
timeout(delay) {
this.#timer = AbortSignal.timeout(delay);
this.#timer.addEventListener('abort', this.#abort, { once: true });
}
close() {
this.#timer?.removeEventListener('abort', this.#abort);
this.#timer = undefined;
super.close();
}
}
```
`close()` here is still useful, but the `follow()` feels superfluous.
--
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-987112406
Received on Monday, 6 December 2021 19:28:28 UTC