Add boot phase status messages
This commit is contained in:
@@ -8,6 +8,8 @@ function setBootStatus(message: string): void {
|
|||||||
document.getElementById('boot-status')!.textContent = message;
|
document.getElementById('boot-status')!.textContent = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setBootStatus('Starting frontend bundle...');
|
||||||
|
|
||||||
window.addEventListener('error', (event) => {
|
window.addEventListener('error', (event) => {
|
||||||
setBootStatus(`Frontend error: ${event.message || 'unknown'}`);
|
setBootStatus(`Frontend error: ${event.message || 'unknown'}`);
|
||||||
});
|
});
|
||||||
@@ -16,11 +18,17 @@ window.addEventListener('unhandledrejection', (event) => {
|
|||||||
setBootStatus(`Frontend rejection: ${String(event.reason || 'unknown')}`);
|
setBootStatus(`Frontend rejection: ${String(event.reason || 'unknown')}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const bootTimeout = window.setTimeout(() => {
|
||||||
|
setBootStatus('Bootstrap still running...');
|
||||||
|
}, 3000);
|
||||||
|
|
||||||
bootstrapApplication(AppComponent, appConfig)
|
bootstrapApplication(AppComponent, appConfig)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
window.clearTimeout(bootTimeout);
|
||||||
document.getElementById('boot-status')?.remove();
|
document.getElementById('boot-status')?.remove();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
window.clearTimeout(bootTimeout);
|
||||||
console.error(err);
|
console.error(err);
|
||||||
setBootStatus(`Bootstrap failed: ${String(err)}`);
|
setBootStatus(`Bootstrap failed: ${String(err)}`);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user