MCPcopy Index your code
hub / github.com/Maps4HTML/MapML.js / connectedCallback

Method connectedCallback

src/map-link.js:267–326  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

265 super();
266 }
267 async connectedCallback() {
268 this.#hasConnected = true; /* jshint ignore:line */
269 if (
270 this.getLayerEl().hasAttribute('data-moving') ||
271 (this.parentExtent && this.parentExtent.hasAttribute('data-moving'))
272 )
273 return;
274 // Layer registry for child map-feature/map-tile layers — see layer.js
275 if (!this._layerRegistry) {
276 this._layerRegistry = new Map();
277 }
278 switch (this.rel.toLowerCase()) {
279 // for some cases, require a dependency check
280 case 'tile':
281 case 'image':
282 case 'features':
283 case 'query':
284 // because we skip the attributeChangedCallback for initialization,
285 // respect the disabled attribute which can be set by the author prior
286 // to initialization
287 if (!this.disabled) {
288 this._initTemplateVars();
289 await this._createTemplatedLink();
290 }
291 break;
292 case 'style':
293 case 'self':
294 case 'style self':
295 case 'self style':
296 this._createSelfOrStyleLink();
297 break;
298 case 'zoomin':
299 case 'zoomout':
300 // this._createZoominOrZoomoutLink();
301 break;
302 case 'legend':
303 //this._createLegendLink();
304 break;
305 case 'stylesheet':
306 if (!this.disabled) {
307 this._createStylesheetLink();
308 }
309 break;
310 case 'alternate':
311 this._createAlternateLink(); // add media attribute
312 break;
313 case 'license':
314 // this._createLicenseLink();
315 break;
316 }
317 // the media attribute uses / overrides the disabled attribute to enable or
318 // disable the link, so at this point the #hasConnected must be true so
319 // that the disabled attributeChangedCallback can have its desired side effect
320 await this._registerMediaQuery(this.media);
321 // create the type of templated leaflet layer appropriate to the rel value
322 // image/map/features = templated(Image/Feature), tile=templatedTile,
323 // this._tempatedTileLayer = Util.templatedTile(pane: this.extentElement._leafletLayer._container)
324 // add to viewer._map dependant on map-extent.checked, map-layer.checked

Callers

nothing calls this directly

Calls 7

getLayerElMethod · 0.95
_initTemplateVarsMethod · 0.95
_createTemplatedLinkMethod · 0.95
_createStylesheetLinkMethod · 0.95
_createAlternateLinkMethod · 0.95
_registerMediaQueryMethod · 0.95

Tested by

no test coverage detected