Transition more requests to fetch

This commit is contained in:
Marwin Hochfelsner 2025-02-13 16:50:18 +01:00
parent 46f642d5cd
commit bf194952d7
7 changed files with 85 additions and 91 deletions

View file

@ -75,10 +75,12 @@ OSM.initializeNotesLayer = function (map) {
if (noteLoader) noteLoader.abort();
noteLoader = $.ajax({
url: url,
success: success
});
noteLoader = new AbortController();
fetch(url, { signal: noteLoader.signal })
.then(response => response.json())
.then(success)
.catch(() => {})
.finally(() => noteLoader = null);
}
function success(json) {
@ -93,8 +95,6 @@ OSM.initializeNotesLayer = function (map) {
for (var id in oldNotes) {
noteLayer.removeLayer(oldNotes[id]);
}
noteLoader = null;
}
}
};