Move boot diagnostics into app bundle

This commit is contained in:
Dymas
2026-06-22 10:20:47 +02:00
parent e5d09fe02b
commit b52510df67
2 changed files with 16 additions and 15 deletions
-14
View File
@@ -10,19 +10,5 @@
<body>
<div id="boot-status">Loading Jarri Spooty...</div>
<app-root></app-root>
<script>
window.addEventListener('error', function (event) {
var boot = document.getElementById('boot-status');
if (boot) {
boot.textContent = 'Frontend error: ' + (event.message || 'unknown');
}
});
window.addEventListener('unhandledrejection', function (event) {
var boot = document.getElementById('boot-status');
if (boot) {
boot.textContent = 'Frontend rejection: ' + String(event.reason || 'unknown');
}
});
</script>
</body>
</html>
+16 -1
View File
@@ -4,11 +4,26 @@ import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';
import { devTools } from '@ngneat/elf-devtools';
function setBootStatus(message: string): void {
document.getElementById('boot-status')!.textContent = message;
}
window.addEventListener('error', (event) => {
setBootStatus(`Frontend error: ${event.message || 'unknown'}`);
});
window.addEventListener('unhandledrejection', (event) => {
setBootStatus(`Frontend rejection: ${String(event.reason || 'unknown')}`);
});
bootstrapApplication(AppComponent, appConfig)
.then(() => {
document.getElementById('boot-status')?.remove();
})
.catch((err) => console.error(err));
.catch((err) => {
console.error(err);
setBootStatus(`Bootstrap failed: ${String(err)}`);
});
if (isDevMode()) {
devTools();