Display error if JS fails to load. Fixes #404

This commit is contained in:
James Lyne 2022-05-31 11:58:56 +01:00
parent a359652e93
commit af2ab839ac
3 changed files with 12 additions and 0 deletions

View File

@ -386,5 +386,15 @@
<main id="app" aria-hidden="true"></main>
<script type="module" src="/src/main.ts"></script>
<script>
window.addEventListener('load', () => {
if(!window.liveAtlasLoaded) {
document.getElementById('splash__error').setAttribute('aria-hidden', 'false');
document.getElementById('splash__error-message').innerText = 'Required LiveAtlas files are missing or failed to load.\nPlease reinstall LiveAtlas.';
document.getElementById('splash__spinner').style.visibility = 'hidden';
}
});
</script>
</body>
</html>

1
src/index.d.ts vendored
View File

@ -47,6 +47,7 @@ declare global {
// noinspection JSUnusedGlobalSymbols
interface Window {
liveAtlasConfig: LiveAtlasGlobalConfig,
liveAtlasLoaded: ?boolean,
}
declare const process : {

View File

@ -59,6 +59,7 @@ registerMapProvider('squaremap', Pl3xmapMapProvider);
registerMapProvider('overviewer', OverviewerMapProvider);
const config = window.liveAtlasConfig;
window.liveAtlasLoaded = true;
try {
config.servers = loadConfig(config);