mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-05 01:24:53 +01:00
viewer: switch to modern fetch API, do not cache metadata and entity files
This commit is contained in:
parent
3d024c6cd8
commit
643035eaed
1 changed files with 59 additions and 67 deletions
|
@ -284,10 +284,10 @@ function createSign(sign, back) {
|
||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSigns(signLayer) {
|
async function loadSigns(signLayer) {
|
||||||
const xhr = new XMLHttpRequest();
|
const response = await fetch('data/entities.json', {cache: 'no-store'});
|
||||||
xhr.onload = function () {
|
const res = await response.json();
|
||||||
const res = JSON.parse(this.responseText);
|
|
||||||
const groups = {};
|
const groups = {};
|
||||||
|
|
||||||
// Group signs by x,z coordinates
|
// Group signs by x,z coordinates
|
||||||
|
@ -341,19 +341,14 @@ function loadSigns(signLayer) {
|
||||||
if (params.marker && x === params.marker[0] && z === params.marker[1])
|
if (params.marker && x === params.marker[0] && z === params.marker[1])
|
||||||
marker.openPopup();
|
marker.openPopup();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
xhr.open('GET', 'data/entities.json', true);
|
|
||||||
xhr.send();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.createMap = function () {
|
window.createMap = function () {
|
||||||
const xhr = new XMLHttpRequest();
|
(async function () {
|
||||||
xhr.onload = function () {
|
const response = await fetch('data/info.json', {cache: 'no-store'});
|
||||||
const res = JSON.parse(this.responseText),
|
const res = await response.json();
|
||||||
mipmaps = res.mipmaps,
|
const {mipmaps, spawn} = res;
|
||||||
spawn = res.spawn,
|
const features = res.features || {};
|
||||||
features = res.features || {};
|
|
||||||
|
|
||||||
const updateParams = function () {
|
const updateParams = function () {
|
||||||
const args = parseHash();
|
const args = parseHash();
|
||||||
|
@ -489,8 +484,5 @@ window.createMap = function () {
|
||||||
updateHash();
|
updateHash();
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
})();
|
||||||
|
|
||||||
xhr.open('GET', 'data/info.json', true);
|
|
||||||
xhr.send();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue