import { bootstrapApplication } from '@angular/platform-browser'; import { resolveRestoredRendererRoute } from '@iptvnator/shared/interfaces'; import { registerAppDateLocales } from './app/app-date-locales'; import { AppComponent } from './app/app.component'; import { appConfig } from './app/app.config'; registerAppDateLocales(); // A reloaded packaged renderer arrives on index.html with the route it was // on carried in the query string (the Electron main process recovers the // file:// reload that way). Put that route back before the router reads the // URL for its initial navigation. const restoredHref = resolveRestoredRendererRoute( window.location.href, document.baseURI ); if (restoredHref !== null) { window.history.replaceState(window.history.state, '', restoredHref); } bootstrapApplication(AppComponent, appConfig) .then(() => { // Splash is rendered eagerly by index.html so the user sees something // immediately instead of a blank Material-grey background. Once Angular // is bootstrapped, AppComponent has rendered and we can drop the // splash. requestAnimationFrame ensures the swap happens after the // first AppComponent paint, avoiding a flash of empty background // between splash removal and Angular's first frame. requestAnimationFrame(() => { document.getElementById('initial-splash')?.remove(); }); }) .catch((err) => console.error(err));