import { ChangeDetectionStrategy , Component , HostBinding , OnDestroy , OnInit , } from '@angular/core' ; import { ConfigsService } from '../../../../common/services/configs.service' ; import { ChannelContentService } from './content.service' ; import { Session } from '../../../../services/session' ; import { Subscription } from 'rxjs' ; author Ben Hayward
  @ Component ( { selector : 'm-channel__content' , changeDetection : ChangeDetectionStrategy . OnPush , templateUrl : 'content.component.html' , providers : [ ChannelContentService ] , host : { '[class.m-channelContent--nsfw]' : 'channelIsNsfw' } , } ) export class ChannelContentComponent implements OnInit , OnDestroy { /**
     * Assets CDN URL
     */ readonly cdnAssetsUrl : string ; protected stateSubscription : Subscription ; protected channelIsNsfw : boolean = false ; param content param session param configs constructor ( public content , public session , configs ) { this . cdnAssetsUrl = configs . get ( 'cdn_assets_url' ) ; } ngOnInit ( ) { this . stateSubscription = this . content . state$ . subscribe ( state => { this . channelIsNsfw = state === 'nsfw' ; } ) ; } ngOnDestroy ( ) { if ( this . stateSubscription ) { this . stateSubscription . unsubscribe ( ) ; } } }