MCPcopy Create free account
hub / github.com/neomjs/neo / connectedCallback

Method connectedCallback

src/main/addon/WebComponent.mjs:30–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

28 registerElementLoader() {
29 customElements.define('element-loader', class extends HTMLElement {
30 async connectedCallback() {
31 let me = this,
32 content, styles;
33
34 // move OPs will trigger the connectedCallback() again
35 if (!me.shadowRoot) {
36 content = await (await fetch(me.getAttribute('src'))).text();
37
38 me.attachShadow({mode: 'open'}).innerHTML = content;
39
40 styles = me.querySelector('style');
41 styles && me.shadowRoot.append(styles)
42 }
43 }
44 });
45 }
46}

Callers

nothing calls this directly

Calls 1

fetchFunction · 0.50

Tested by

no test coverage detected