Prevent Unmanaged watchPosition on Repeated map.locate() Calls (#9746)

Co-authored-by: Jørgen Sneisen <jorgen.sneisen@where2o.com>
This commit is contained in:
Jørgen Sneisen
2025-06-06 19:23:39 +02:00
committed by GitHub
parent 03cd98fc66
commit 27502be157

View File

@ -649,6 +649,9 @@ export const Map = Evented.extend({
onError = this._handleGeolocationError.bind(this);
if (options.watch) {
if (this._locationWatchId !== undefined) {
navigator.geolocation.clearWatch(this._locationWatchId);
}
this._locationWatchId =
navigator.geolocation.watchPosition(onResponse, onError, options);
} else {