Syntax error 'id' not allowed error fixed
This commit is contained in:
parent
912f32e7ab
commit
999274e946
|
@ -22,6 +22,7 @@ export default class Room extends EventTarget
|
|||
{
|
||||
public mwse : MWSE;
|
||||
public options! : IRoomOptions;
|
||||
public config! : IRoomOptions;
|
||||
public roomId? : string;
|
||||
public accessType? : "public"|"private";
|
||||
public description? : string;
|
||||
|
@ -52,7 +53,7 @@ export default class Room extends EventTarget
|
|||
autoFetchInfo: true
|
||||
};
|
||||
Object.assign(defaultOptions,options);
|
||||
this.options = defaultOptions as IRoomOptions;
|
||||
this.config = defaultOptions as IRoomOptions;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,21 +61,21 @@ export default class Room extends EventTarget
|
|||
this.roomId = uuid;
|
||||
}
|
||||
async createRoom(roomOptions : IRoomOptions){
|
||||
let options = this.options || roomOptions;
|
||||
let config = this.config || roomOptions;
|
||||
let result = await this.mwse.EventPooling.request({
|
||||
type:'create-room',
|
||||
...options
|
||||
...config
|
||||
});
|
||||
if(result.status == 'fail')
|
||||
{
|
||||
if(result.message == "ALREADY-EXISTS" && this.options.ifexistsJoin)
|
||||
if(result.message == "ALREADY-EXISTS" && this.config.ifexistsJoin)
|
||||
{
|
||||
return this.join();
|
||||
}
|
||||
throw new Error(result.message || result.messages);
|
||||
}else{
|
||||
this.options = {
|
||||
...this.options,
|
||||
...this.config,
|
||||
...result.room
|
||||
};
|
||||
this.roomId = result.room.id;
|
||||
|
@ -84,16 +85,16 @@ export default class Room extends EventTarget
|
|||
async join(){
|
||||
let result = await this.mwse.EventPooling.request({
|
||||
type:'joinroom',
|
||||
name: this.options.name,
|
||||
credential: this.options.credential,
|
||||
autoFetchInfo: this.options.autoFetchInfo || false
|
||||
name: this.config.name,
|
||||
credential: this.config.credential,
|
||||
autoFetchInfo: this.config.autoFetchInfo || false
|
||||
});
|
||||
if(result.status == 'fail')
|
||||
{
|
||||
throw new Error(result.message);
|
||||
}else{
|
||||
this.options = {
|
||||
...this.options,
|
||||
...this.config,
|
||||
...result.room
|
||||
};
|
||||
if(result.info)
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue