import { Call , UserFacingDiagnosticsFeature , Features , MediaDiagnosticChangedEventArgs , NetworkDiagnosticChangedEventArgs } from '@azure/communication-calling' ; import { EventEmitter } from 'events' ; import { MediaDiagnosticChangedEvent , NetworkDiagnosticChangedEvent } from './CallAdapter' ; private export class DiagnosticsForwarder { private _diagnostics : UserFacingDiagnosticsFeature ; private _emitter : EventEmitter ; constructor ( emitter , call ) { this . _diagnostics = call . feature ( Features . UserFacingDiagnostics ) ; this . _emitter = emitter ; this . subscribe ( ) ; } public unsubscribe = ( ) : void => { this . _diagnostics . network . off ( 'diagnosticChanged' , this . networkDiagnosticsChanged . bind ( this ) ) ; this . _diagnostics . media . off ( 'diagnosticChanged' , this . mediaDiagnosticsChanged . bind ( this ) ) ; } ; private subscribe ( ) { this . _diagnostics . network . on ( 'diagnosticChanged' , this . networkDiagnosticsChanged . bind ( this ) ) ; this . _diagnostics . media . on ( 'diagnosticChanged' , this . mediaDiagnosticsChanged . bind ( this ) ) ; } private networkDiagnosticsChanged ( args ) { const event = { type : 'network' , ... args } ; this . _emitter . emit ( 'diagnosticChanged' , event ) ; } private mediaDiagnosticsChanged ( args ) { const event = { type : 'media' , ... args } ; this . _emitter . emit ( 'diagnosticChanged' , event ) ; } }