UNPKG

@azure/communication-react

Version:

React library for building modern communication user experiences utilizing Azure Communication Services

30 lines 1.21 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { Features } from '@azure/communication-calling'; /** * @private */ export class DiagnosticsForwarder { constructor(emitter, call) { this.unsubscribe = () => { this._diagnostics.network.off('diagnosticChanged', this.networkDiagnosticsChanged.bind(this)); this._diagnostics.media.off('diagnosticChanged', this.mediaDiagnosticsChanged.bind(this)); }; this._diagnostics = call.feature(Features.UserFacingDiagnostics); this._emitter = emitter; this.subscribe(); } subscribe() { this._diagnostics.network.on('diagnosticChanged', this.networkDiagnosticsChanged.bind(this)); this._diagnostics.media.on('diagnosticChanged', this.mediaDiagnosticsChanged.bind(this)); } networkDiagnosticsChanged(args) { const event = Object.assign({ type: 'network' }, args); this._emitter.emit('diagnosticChanged', event); } mediaDiagnosticsChanged(args) { const event = Object.assign({ type: 'media' }, args); this._emitter.emit('diagnosticChanged', event); } } //# sourceMappingURL=DiagnosticsForwarder.js.map