Re: [whatwg/dom] Allow subclassing of AbortController / AbortSignal (Issue #1162)

I think the only reason `new WatchSignal` throws is because `new AbortSignal` throws. Generally you can subclass web platform objects.

I guess what you need is that when you instantiate a subclass of `AbortController` you need some kind of way to override the creation of an `AbortSignal` with another subclass. Perhaps using https://blog.domenic.me/the-revealing-constructor-pattern/?

And then perhaps `AbortSignal.abort()` and `AbortSignal.timeout()` need to be able to return a subclass when used on one. I think JavaScript has some capability for that as well, but I believe that feature is not much liked.

Overall though I think your rationale is sound and I think people generally appreciated being able to do this with `EventTarget`.

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

Message ID: <whatwg/dom/issues/1162/1431362154@github.com>

Received on Wednesday, 15 February 2023 13:22:14 UTC