mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-16 16:45:22 +00:00
Prevent Unmanaged watchPosition on Repeated map.locate() Calls (#9746)
Co-authored-by: Jørgen Sneisen <jorgen.sneisen@where2o.com>
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user