first commit

This commit is contained in:
Janis
2022-10-25 18:27:02 +02:00
commit 1315c39ae1
13 changed files with 297 additions and 0 deletions

34
js/parser.js Normal file
View File

@@ -0,0 +1,34 @@
function parseChannelInfos(channelInfos) {
let result = [];
let rootChannels = channelInfos.rootChannels;
let subChannels = channelInfos.subChannels;
rootChannels.forEach((rc) => {
result.push(new Channel(rc.id, rc.properties.name));
if (rc.id in subChannels) {
subChannels[rc.id].forEach((sc) => {
result.push(new Channel(sc.id, sc.properties.name));
});
}
});
return result;
}
function parseClientInfos(clientInfos) {
let result = [];
clientInfos.forEach((e) => {
result.push(
new Client(
e.id,
channels.filter((obj) => {
return obj.id === e.channelId;
})[0],
e.properties.nickname,
e.properties.inputMuted,
e.properties.outputMuted
)
);
});
return result;
}