Prefer using super over prototype calls

This commit is contained in:
James Lyne 2021-08-31 16:38:19 +01:00
parent 0ae42a9409
commit fdf5e521d8
2 changed files with 4 additions and 5 deletions

View File

@ -27,7 +27,6 @@ import {nextTick, watch} from "vue";
import {handleKeyboardEvent} from "@/util/events"; import {handleKeyboardEvent} from "@/util/events";
import LayersObject = Control.LayersObject; import LayersObject = Control.LayersObject;
import LayersOptions = Control.LayersOptions; import LayersOptions = Control.LayersOptions;
import Layers = Control.Layers;
const store = useStore(); const store = useStore();
@ -199,7 +198,7 @@ export class LiveAtlasLayerControl extends Control.Layers {
input.defaultChecked = checked; input.defaultChecked = checked;
} else { } else {
// @ts-ignore // @ts-ignore
input = Layers.prototype._createRadioElement.call(this, 'leaflet-base-layers_' + Util.stamp(this), checked); input = super._createRadioElement('leaflet-base-layers_' + Util.stamp(this), checked);
} }
input.layerId = Util.stamp(obj.layer); input.layerId = Util.stamp(obj.layer);
@ -207,7 +206,7 @@ export class LiveAtlasLayerControl extends Control.Layers {
label.textContent = obj.name; label.textContent = obj.name;
// @ts-ignore // @ts-ignore
DomEvent.on(input, 'click', (e: LeafletEvent) => Layers.prototype._onInputClick.call(this, e), this); DomEvent.on(input, 'click', (e: LeafletEvent) => super._onInputClick(e), this);
item.appendChild(input); item.appendChild(input);
item.insertAdjacentHTML('beforeend', ` item.insertAdjacentHTML('beforeend', `
@ -219,7 +218,7 @@ export class LiveAtlasLayerControl extends Control.Layers {
container!.appendChild(item); container!.appendChild(item);
// @ts-ignore // @ts-ignore
Layers.prototype._checkDisabledLayers.call(this); super._checkDisabledLayers();
return label; return label;
} }

View File

@ -75,7 +75,7 @@ export class GenericIcon extends DivIcon {
this._image.src = url; this._image.src = url;
// @ts-ignore // @ts-ignore
Icon.prototype._setIconStyles.call(this, div, 'icon'); super._setIconStyles.call(div, 'icon');
div.appendChild(this._image); div.appendChild(this._image);
div.classList.add('marker'); div.classList.add('marker');