Stage 253

This commit is contained in:
Abdussamed ULUTAŞ 2022-12-22 23:18:19 +03:00
parent 85590b9cfa
commit 5d1a19a94a
3 changed files with 12 additions and 7 deletions

View File

@ -21,13 +21,12 @@ export default class Room extends EventTarget
public mwse : MWSE; public mwse : MWSE;
public options! : IRoomOptions; public options! : IRoomOptions;
public roomId? : string; public roomId? : string;
public accessType? : "public"|"private"; public accessType? : "public"|"private";
public description? : string; public description? : string;
public joinType? : "free"|"invite"|"password"|"lock"; public joinType? : "free"|"invite"|"password"|"lock";
public name? : string; public name? : string;
public owner? : string; public owner? : string;
public peers? : Map<string,Peer>; public peers : Map<string,Peer> = new Map();
public ifexistsJoin : boolean = false; public ifexistsJoin : boolean = false;
constructor(wsts:MWSE){ constructor(wsts:MWSE){
@ -107,13 +106,19 @@ export default class Room extends EventTarget
type:'room-peers', type:'room-peers',
roomId: this.roomId roomId: this.roomId
}) as {type:"success"|"fail", peers: string[]}; }) as {type:"success"|"fail", peers: string[]};
let cup : Peer[] = [];
if(type == 'fail') if(type == 'fail')
{ {
throw new Error("Cant using peers on room") throw new Error("Cant using peers on room")
}else if(type == 'success'){ }else if(type == 'success'){
for (const peer of peers) { for (const peerid of peers) {
this.mwse.peer(peer); let peer = this.mwse.peer(peerid);
cup.push(peer);
this.peers.set(peerid, peer);
} }
} };
return cup;
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long