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

Method attributeChangedCallback

src/layer.js:91–134  ·  view source on GitHub ↗
(name, oldValue, newValue)

Source from the content-addressed store, hash-verified

89 : null;
90 }
91 attributeChangedCallback(name, oldValue, newValue) {
92 if (this.#hasConnected /* jshint ignore:line */) {
93 switch (name) {
94 case 'label':
95 this._layer.setName(newValue);
96 break;
97 case 'checked':
98 if (typeof newValue === 'string') {
99 this.parentElement._map.addLayer(this._layer);
100 } else {
101 this.parentElement._map.removeLayer(this._layer);
102 }
103 this._layerControlCheckbox.checked = this.checked;
104 break;
105 case 'hidden':
106 if (typeof newValue === 'string') {
107 this._layerControl.removeLayer(this._layer);
108 } else {
109 this._layerControl.addOrUpdateOverlay(this._layer, this.label);
110 this._validateDisabled();
111 }
112 break;
113 case 'opacity':
114 if (oldValue !== newValue && this._layer) {
115 this._opacity = newValue;
116 this._layer.changeOpacity(newValue);
117 }
118 break;
119 case 'src':
120 if (oldValue !== newValue) {
121 this._onRemove();
122 if (this.isConnected) {
123 this._onAdd();
124 }
125 }
126 break;
127 case 'media':
128 if (oldValue !== newValue) {
129 this._registerMediaQuery(newValue);
130 }
131 break;
132 }
133 }
134 }
135 _registerMediaQuery(mq) {
136 if (!this._changeHandler) {
137 this._changeHandler = () => {

Callers

nothing calls this directly

Calls 4

_validateDisabledMethod · 0.95
_onRemoveMethod · 0.95
_onAddMethod · 0.95
_registerMediaQueryMethod · 0.95

Tested by

no test coverage detected