- From: Keith Cirkel <notifications@github.com>
- Date: Tue, 26 Jul 2022 05:01:29 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 26 July 2022 12:01:46 UTC
The work-arounds for this, for now, are to either override `attachInternals`:
```js
class Base extends HTMLElement {
#internals
#internalsCalled = false
constructor() {
super()
this.attachInternals()
this.#internalsCalled = false
}
attachInternals() {
if (this.#internals && !this.#internalsCalled) {
this.#internalsCalled = true
return this.#internals
}
this.#internals = super.attachInternals()
this.#internalsCalled = true
return this.#internals
}
}
```
Or to provide some agreed upon interface in your own libraries, like `getInternals()`, which breaks the privacy contract around `attachInternals` unless you're able to use TypeScript's `protected` property in all code.
--
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/962#issuecomment-1195391839
You are receiving this because you are subscribed to this thread.
Message ID: <WICG/webcomponents/issues/962/1195391839@github.com>
Received on Tuesday, 26 July 2022 12:01:46 UTC