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