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> <body>
<div id="boot-status">Loading Jarri Spooty...</div> <div id="boot-status">Loading Jarri Spooty...</div>
<app-root></app-root> <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> </body>
</html> </html>
+16 -1
View File
@@ -4,11 +4,26 @@ import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component'; import { AppComponent } from './app/app.component';
import { devTools } from '@ngneat/elf-devtools'; 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) bootstrapApplication(AppComponent, appConfig)
.then(() => { .then(() => {
document.getElementById('boot-status')?.remove(); document.getElementById('boot-status')?.remove();
}) })
.catch((err) => console.error(err)); .catch((err) => {
console.error(err);
setBootStatus(`Bootstrap failed: ${String(err)}`);
});
if (isDevMode()) { if (isDevMode()) {
devTools(); devTools();