import { Injectable } from '@angular/core' ; import { Subject } from 'rxjs' ; export interface SubHeaderValue { playerUsername : string ; playerGame : string ; playerLogo : string ; } @ Injectable ( ) export class ToolbarService implements SubHeaderValue { title : string ; logo : string ; playerUsername : string ; playerGame : string ; playerLogo : string ; private titleChange = new Subject < string > ( ) ; titleChange$ = this . titleChange . asObservable ( ) ; private logoChange = new Subject < string > ( ) ; logoChange$ = this . logoChange . asObservable ( ) ; private subheaderChange = new Subject < SubHeaderValue > ( ) ; subheaderChange$ = this . subheaderChange . asObservable ( ) ; setTitle ( title ) { this . title = title ; this . titleChange . next ( title ) ; } setLogo ( logo ) { this . logo = logo ; this . logoChange . next ( logo ) ; } setSubheader ( subHeader ) { if ( subHeader === null ) { this . playerUsername = null ; this . playerGame = null ; this . subheaderChange . next ( null ) ; } else { this . playerUsername = subHeader . playerUsername ; this . playerGame = subHeader . playerGame ; this . playerLogo = subHeader . playerLogo ; this . subheaderChange . next ( subHeader ) ; } } }