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

> doesn't allow for class fields or constructor initialisation logic in the signal

Return override permits this.

```js
class WatchSignal extends function(o) { return Object.setPrototypeOf(o, new.target.prototype); } {
  #fields = "here"
}

class WatchController extends AbortController {
  constructor() {
    new WatchSignal(super().signal);
  }
}
```

(Note the use of new.target.prototype in the “identity class”: honoring new.target.prototype permits further subclassing of WatchSignal without needing to do this again.)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1162#issuecomment-1431788012

You are receiving this because you are subscribed to this thread.

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

Received on Wednesday, 15 February 2023 18:03:20 UTC