// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
 * @private
 */
export class RealTimeTextSubscriber {
    constructor(callIdRef, context, realTimeText) {
        this.subscribe = () => {
            this._realTimeTextFeature.on('realTimeTextReceived', this.realTimeTextReceived);
        };
        this.unsubscribe = () => {
            this._realTimeTextFeature.off('realTimeTextReceived', this.realTimeTextReceived);
        };
        this.realTimeTextReceived = (data) => {
            this._context.setIsRealTimeTextActive(this._callIdRef.callId, true);
            this._context.addRealTimeText(this._callIdRef.callId, data);
        };
        this._callIdRef = callIdRef;
        this._context = context;
        this._realTimeTextFeature = realTimeText;
        this.subscribe();
    }
}
//# sourceMappingURL=RealTimeTextSubscriber.js.map