@signiant/media-shuttle-sdk-base
Version:
The base parent sdk behind other media shuttle sdks (e.g. media-shuttle-sdk)
63 lines (62 loc) • 2.88 kB
JavaScript
/* eslint-disable import/first */
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import MessageChannel from './MessageChannel';
import EventNotifier from '../EventNotifier';
import LogManager from '../../system/LogManager';
var MessageChannelProvider = /** @class */ (function (_super) {
__extends(MessageChannelProvider, _super);
function MessageChannelProvider(channelParams) {
var _this = _super.call(this) || this;
_this._channelParams = channelParams;
_this._eventNotifier = new EventNotifier();
return _this;
}
MessageChannelProvider.prototype.setEventHandler = function (originatorId, event, handler) {
this._eventNotifier.setEventHandler(originatorId, event, handler);
};
MessageChannelProvider.prototype.setSessionActiveEventHandler = function (handler) {
this._eventNotifier.setSessionActiveEventHandler(handler);
};
MessageChannelProvider.prototype.removeEventHandlers = function (originatorId) {
return this._eventNotifier.removeEventHandlers(originatorId);
};
MessageChannelProvider.prototype.setErrorCallback = function (callback) {
this._errorCallback = callback;
};
MessageChannelProvider.prototype.notifyMessage = function (message) {
LogManager.debug('Receive message:', message);
this._eventNotifier.notifyMessage(message);
};
MessageChannelProvider.prototype.getChannelParams = function () {
return this._channelParams;
};
MessageChannelProvider.prototype.removeAllEventHandlers = function () {
this._eventNotifier.removeAllEventHandlers();
};
MessageChannelProvider.prototype.removeEventHandler = function (originatorId, event) {
return this._eventNotifier.removeEventHandler(originatorId, event);
};
MessageChannelProvider.prototype.reset = function () {
this.removeAllEventHandlers();
this.unsubscribeFromChannels();
};
MessageChannelProvider.prototype.updateSettings = function (settings) {
LogManager.info(settings);
};
return MessageChannelProvider;
}(MessageChannel));
export default MessageChannelProvider;