Remove usage of global L and safeguard against it (#8536)

This commit is contained in:
Volodymyr Agafonkin
2022-10-06 19:57:40 +03:00
committed by GitHub
parent 0bfedaebeb
commit 8ae526bab8
6 changed files with 11 additions and 4 deletions

5
docs/.eslintrc Normal file
View File

@ -0,0 +1,5 @@
{
"globals": {
"L": true
}
}

View File

@ -70,7 +70,6 @@
],
"root": true,
"globals": {
"L": true,
"globalThis": true
},
"env": {

View File

@ -7,6 +7,7 @@
"mocha": true
},
"globals": {
"L": true,
"expect": false,
"sinon": false,
"happen": false,

View File

@ -120,6 +120,7 @@ Class.addInitHook = function (fn) { // (Function) || (String, args...)
};
function checkDeprecatedMixinEvents(includes) {
/* global L: true */
if (typeof L === 'undefined' || !L || !L.Mixin) { return; }
includes = Util.isArray(includes) ? includes : [includes];

View File

@ -1,5 +1,6 @@
import * as DomEvent from './DomEvent';
import Browser from '../core/Browser';
import {falseFn} from '../core/Util';
/*
* Extends L.DomEvent to provide touch support for Internet Explorer and Windows-based devices.
@ -33,7 +34,7 @@ export function addPointerListener(obj, type, handler) {
}
if (!handle[type]) {
console.warn('wrong event specified:', type);
return L.Util.falseFn;
return falseFn;
}
handler = handle[type].bind(this, handler);
obj.addEventListener(pEvent[type], handler, false);

View File

@ -2,7 +2,7 @@ import {Map} from '../map/Map';
import {Layer} from './Layer';
import {FeatureGroup} from './FeatureGroup';
import * as Util from '../core/Util';
import {toLatLng} from '../geo/LatLng';
import {toLatLng, LatLng} from '../geo/LatLng';
import {toPoint} from '../geometry/Point';
import * as DomUtil from '../dom/DomUtil';
@ -42,7 +42,7 @@ export var DivOverlay = Layer.extend({
},
initialize: function (options, source) {
if (options && (options instanceof L.LatLng || Util.isArray(options))) {
if (options && (options instanceof LatLng || Util.isArray(options))) {
this._latlng = toLatLng(options);
Util.setOptions(this, source);
} else {