UNPKG

sinch-rtc

Version:

RTC JavaScript/Web SDK

37 lines 1.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseDetector = void 0; const CallQualityWarningEventType_1 = require("../CallQualityWarningEventType"); /** * Base class for all detectors providing a common interface for all detectors and it is meants * to be extended by every specific detector implementation. * * The implementation should use the `emitWarning` method to emit a warning event. This assures proper * propagation of the event to the listeners and handles the state of the detector. */ class BaseDetector { constructor(fanout) { this.fanout = fanout; this._isInTriggeredState = false; this._isActive = false; } get isInTriggeredState() { return this._isInTriggeredState; } set isInTriggeredState(isInTriggeredState) { this._isInTriggeredState = isInTriggeredState; } get isActive() { return this._isActive; } set isActive(isActive) { this._isActive = isActive; } emitWarning(callQualityWarningEvent) { this.isInTriggeredState = callQualityWarningEvent.type === CallQualityWarningEventType_1.CallQualityWarningEventType.Trigger; this.fanout.onEvent(callQualityWarningEvent); } } exports.BaseDetector = BaseDetector; //# sourceMappingURL=BaseDetector.js.map