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

Method disconnectedCallback

src/map-feature.js:217–246  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215 }
216
217 disconnectedCallback() {
218 if (
219 this.getLayerEl()?.hasAttribute('data-moving') ||
220 this._parentEl.parentElement?.hasAttribute('data-moving')
221 )
222 return;
223 this._observer.disconnect();
224 // Decrement layer registry count
225 const entry = this._parentEl?._layerRegistry?.get(this.position);
226 if (entry) {
227 entry.count--;
228 if (entry.count === 0) {
229 this._parentEl._layerRegistry.delete(this.position);
230 }
231 }
232 if (this._featureLayer) {
233 this.removeFeature(this._featureLayer);
234 // If this was the last feature in the layer, clean up the layer
235 if (this._featureLayer.getLayers().length === 0) {
236 if (this._featureLayer.options.renderer) {
237 // since this is the last reference to the MapFeatureLayer, we need to also
238 // manually remove the shared renderer
239 this._featureLayer.options.renderer.remove();
240 }
241 this._featureLayer.remove();
242 this._featureLayer = null;
243 delete this._featureLayer;
244 }
245 }
246 }
247
248 reRender(layerToRenderOn) {
249 // this is for re-generating the rendering in case of <geometry> changes

Callers

nothing calls this directly

Calls 3

getLayerElMethod · 0.95
removeFeatureMethod · 0.95
removeMethod · 0.80

Tested by

no test coverage detected