cloudhub-electron-sdk
Version:
cloudhub-electron-sdk
50 lines (49 loc) • 1.34 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class RoomController {
constructor() {
this.myself = {};
this.users = {};
this.channelId = '';
this.rtcChannels = [];
}
getChannelId() {
return this.channelId;
}
setChannelId(channelId) {
this.channelId = channelId;
}
getRtcChannels() {
return this.rtcChannels;
}
setRtcChannels(IchannelId, rtcChannel) {
this.rtcChannels[IchannelId] = Object.assign(Object.assign({}, this.rtcChannels[IchannelId]), { rtcChannel });
}
getMyself() {
return this.myself;
}
setMyself(data = {}) {
this.myself = Object.assign(this.myself, data);
}
getUser(uid) {
return this.users[uid];
}
getUsers() {
return this.users;
}
setUser(uid, data = {}) {
this.users[uid] = data;
}
setUserProperty(uid, properties = {}) {
if (!uid)
return;
if (uid === this.myself.uid) {
this.myself = Object.assign(this.myself, properties);
}
this.users[uid] = Object.assign(this.users[uid] || {}, properties);
}
delUser(uid) {
delete this.users[uid];
}
}
exports.default = RoomController;