refactor: add loading screen on app initialization
This commit is contained in:
@@ -9,7 +9,7 @@ export const appConfig: ApplicationConfig = {
|
|||||||
providers: [
|
providers: [
|
||||||
provideAppInitializer(() => {
|
provideAppInitializer(() => {
|
||||||
const sqlite = inject(Sqlite);
|
const sqlite = inject(Sqlite);
|
||||||
return sqlite.initializeDatabase('gptdb');
|
return sqlite.initializeDatabase('gptdb').then( () => document.dispatchEvent(new CustomEvent('ng-boot')))
|
||||||
}),
|
}),
|
||||||
{provide: WebSqlite, useClass: WebSqlite},
|
{provide: WebSqlite, useClass: WebSqlite},
|
||||||
provideBrowserGlobalErrorListeners(),
|
provideBrowserGlobalErrorListeners(),
|
||||||
|
|||||||
@@ -6,8 +6,16 @@
|
|||||||
<base href="/">
|
<base href="/">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link rel="preload" href="/scan-loading-screen/scan-loading-screen.css" as="style" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<scan-loading-screen></scan-loading-screen>
|
||||||
<app-root></app-root>
|
<app-root></app-root>
|
||||||
|
<script src="/scan-loading-screen/scan-loading-screen.js" fetchpriority="high"></script>
|
||||||
|
<script>
|
||||||
|
document.addEventListener('ng-boot', () => {
|
||||||
|
document.querySelector('scan-loading-screen').remove();
|
||||||
|
})
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user