Move boot diagnostics into app bundle
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user