OSM.initializeNotesLayer = function (map) {
- var noteLayer = map.noteLayer,
- notes = {};
+ let noteLoader;
+ const noteLayer = map.noteLayer;
+ let notes = {};
var noteIcons = {
"new": L.icon({
map.on("moveend", loadNotes);
map.fire("overlayadd", { layer: noteLayer });
}).on("remove", () => {
+ if (noteLoader) noteLoader.abort();
+ noteLoader = null;
map.off("moveend", loadNotes);
noteLayer.clearLayers();
notes = {};
return marker.id;
};
- var noteLoader;
-
function loadNotes() {
var bounds = map.getBounds();
var size = bounds.getSize();