MCPcopy Create free account
hub / github.com/Maps4HTML/MapML.js / connectedCallback

Method connectedCallback

src/map-style.js:118–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116 }
117 }
118 async connectedCallback() {
119 /* jshint ignore:start */
120 this.#hasConnected = true;
121 /* jshint ignore:end */
122 // if the parent element is a map-link, the stylesheet should
123 // be created as part of a templated layer processing i.e. on moveend / when connected
124 // and the generated <style> that implements this <map-style> should be located
125 // in the parent <map-link>._templatedLayer.container root node if
126 // the _templatedLayer is an instance of TemplatedTileLayer or TemplatedFeaturesLayer
127 //
128 // if the parent node (or the host of the shadow root parent node) is map-layer, the link should be created in the _layer
129 // container
130 this._stylesheetHost =
131 this.getRootNode() instanceof ShadowRoot
132 ? this.getRootNode().host
133 : this.parentElement;
134 if (this._stylesheetHost === undefined) return;
135
136 if (this.media) {
137 await this._registerMediaQuery(this.media);
138 } else {
139 this._connect();
140 }
141 }
142 disconnectedCallback() {
143 this._disconnect();
144 }

Callers

nothing calls this directly

Calls 2

_registerMediaQueryMethod · 0.95
_connectMethod · 0.95

Tested by

no test coverage detected