no measurable benefit but maybe useful in the future creates random hangs, just don't use it for the time being some minor loading order adjustments that bring planes on the screen a bit faster
16 lines
446 B
JavaScript
16 lines
446 B
JavaScript
|
|
onmessage = (e) => {
|
|
const url = e.data;
|
|
fetch(new Request(url))
|
|
.then((response) => {
|
|
if (!response.ok) {
|
|
throw new Error(`HTTP error! Status: ${response.status} ${response.url}`);
|
|
}
|
|
return response.json();
|
|
})
|
|
.then((data) => {
|
|
//console.log("worker posting data with url: " + url);
|
|
postMessage({ url: url, json: data });
|
|
})
|
|
};
|