Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

770 B
Raw Blame
import { Component, AfterViewChecked, inject, ChangeDetectionStrategy } from '@angular/core'
import { ViewportScroller } from '@angular/common'

@Component({
  selector: 'my-about-peertube',
  templateUrl: './about-peertube.component.html',
  styleUrls: [ './about-peertube.component.scss' ],
  changeDetection: ChangeDetectionStrategy.Eager,
  standalone: true
})
export class AboutPeertubeComponent implements AfterViewChecked {
  private viewportScroller = inject(ViewportScroller)

  private lastScrollHash: string

  ngAfterViewChecked () {
    if (window.location.hash && window.location.hash !== this.lastScrollHash) {
      this.viewportScroller.scrollToAnchor(window.location.hash.replace('#', ''))

      this.lastScrollHash = window.location.hash
    }
  }
}