- From: Joe Pea <notifications@github.com>
- Date: Tue, 05 Feb 2019 23:15:01 -0800
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 6 February 2019 07:15:23 UTC
I made a module to detect it:
```js
export var isCustomElementsDefineCall = false
const oldDefine = customElements.define
customElements.define = function(tagName, Constructor) {
isCustomElementsDefineCall = true
oldDefine.call(this, tagName, Constructor)
isCustomElementsDefineCall = false
}
```
So then,
```js
import { isCustomElementsDefineCall } from './util/isCustomElementsDefineCall'
class MyEl extends HTMLElement {
constructor() {
if (isCustomElementsDefineCall) {
console.log('created during customElementas.define call')
}
}
}
```
now when I detect this case, I can schedule an observation of children.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/790#issuecomment-460923302
Received on Wednesday, 6 February 2019 07:15:23 UTC