Skip to content

Commit

Permalink
Made the loading screen always display "One or more... failed to load…
Browse files Browse the repository at this point in the history
…. Please refresh" instead of ever "Lost network." which doesn't tell you to refresh.
  • Loading branch information
Naviary2 committed Dec 14, 2024
1 parent 6974c91 commit e4dbf41
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/client/scripts/esm/game/gui/loadingscreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,30 @@ function open() {

function close() {
loadingScreen.classList.add('transparent');

// Hide the error text and show the spinny pawn
element_spinnyPawn!.classList.remove('hidden');
element_loadingError!.classList.add('hidden');
}

function callback_LoadingError(event: Event) {
function onError(event: Event) {
// const type = event.type; // Event type: "error"/"abort"
// const target = event.target; // Element that triggered the event
// const elementType = target?.tagName.toLowerCase();
// const sourceURL = target?.src || target?.href; // URL of the resource that failed to load
// console.error(`Event ${type} ocurred loading ${elementType} at ${sourceURL}.`);


// Hide the "LOADING" text
element_spinnyPawn!.classList.add('hidden');

// Show the ERROR text
const lostNetwork = !navigator.onLine;
element_loadingError!.classList.remove('hidden');
element_loadingErrorText!.textContent = lostNetwork ? translations['lost_network'] : translations['failed_to_load'];
// const lostNetwork = !navigator.onLine;
// element_loadingErrorText!.textContent = lostNetwork ? translations['lost_network'] : translations['failed_to_load'];
element_loadingErrorText!.textContent = translations['failed_to_load'];
}

export default {
open,
close,
callback_LoadingError,
onError,
};

0 comments on commit e4dbf41

Please sign in to comment.