r3-legacy/src/r3-api-socket-cast.js

59 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-04-09 09:35:04 +02:00
/**
2018-08-17 14:53:02 +02:00
* R3.API.Socket.Cast
2018-04-09 09:35:04 +02:00
* @param apiSocket
* @param castType
* @param source
* @param sourceProperties
* @constructor
*/
R3.API.Socket.Cast = function(
apiSocket,
castType,
source,
sourceProperties
) {
if (R3.Utils.UndefinedOrNull(apiSocket)) {
apiSocket = {
2018-08-17 14:53:02 +02:00
socketType : R3.API.Socket.SOCKET_TYPE_CAST
2018-04-09 09:35:04 +02:00
};
}
2018-08-17 14:53:02 +02:00
if (R3.Utils.UndefinedOrNull(apiSocket.socketType)) {
apiSocket.socketType = R3.API.Socket.SOCKET_TYPE_CAST;
}
2018-04-09 09:35:04 +02:00
if (R3.Utils.UndefinedOrNull(castType)) {
castType = R3.API.Socket.Cast.CAST_TYPE_ROOM;
}
this.castType = castType;
if (R3.Utils.UndefinedOrNull(source)) {
source = null;
}
this.source = source;
if (R3.Utils.UndefinedOrNull(sourceProperties)) {
sourceProperties = null;
}
this.sourceProperties = sourceProperties;
2018-08-17 14:53:02 +02:00
R3.API.Socket.call(
2018-04-09 09:35:04 +02:00
this,
2018-08-17 14:53:02 +02:00
apiSocket.id,
apiSocket.name,
apiSocket.socketType,
apiSocket.roomId,
apiSocket.peerId,
apiSocket.server,
2019-07-24 08:08:02 +02:00
apiSocket.parent
2018-04-09 09:35:04 +02:00
);
};
R3.API.Socket.Cast.prototype = Object.create(R3.API.Socket.prototype);
2018-08-17 14:53:02 +02:00
R3.API.Socket.Cast.prototype.constructor = R3.API.Socket.Cast;
2018-04-09 09:35:04 +02:00
R3.API.Socket.Cast.CAST_TYPE_ROOM = 0x1;
R3.API.Socket.Cast.CAST_TYPE_PEER = 0x2;
R3.API.Socket.Cast.CAST_TYPE_ALL = 0x3;
2018-08-17 14:53:02 +02:00
R3.API.Socket.Cast.CAST_TYPE_ALL_BUT_PEER = 0x4;