Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 1x 6x 6x 6x 6x 6x 6x 6x 6x 11x 11x 6x 6x 6x | import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { AfterContentInit, ChangeDetectionStrategy, Component, DestroyRef, inject, OnInit } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { Meta, Title } from '@angular/platform-browser'; import { AppServiceWorkerService } from '@app/client-service-worker'; import { map } from 'rxjs'; import { DOCUMENTATION_ENVIRONMENT } from '../../interfaces/environment.interface'; @Component({ selector: 'app-root', templateUrl: './root.component.html', styleUrls: ['./root.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, }) export class AppDocRootComponent implements OnInit, AfterContentInit { private readonly destroyRef = inject(DestroyRef); private readonly title = inject(Title); private readonly meta = inject(Meta); private readonly bpObserver = inject(BreakpointObserver); private readonly sw = inject(AppServiceWorkerService); private readonly env = inject(DOCUMENTATION_ENVIRONMENT); public readonly version = this.env.meta.version; public readonly config$ = this.bpObserver .observe([Breakpoints.XSmall, Breakpoints.Small, Breakpoints.Medium, Breakpoints.Large, Breakpoints.XLarge]) .pipe( map(state => { const sidenavOpen = !state.breakpoints[Breakpoints.XSmall] && !state.breakpoints[Breakpoints.Small]; return { sidenavOpen }; }), ); /** * Lifecycle hook called on component initialization. * When called does the following: * - sets document title; * - sets document description; */ public ngOnInit(): void { this.title.setTitle(this.env.appName); this.meta.updateTag({ description: this.env.description }); } public ngAfterContentInit(): void { void this.sw.subscribeToUpdates$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(); } } |