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 mwse : MWSE;
|
||||||
public options! : IRoomOptions;
|
public options! : IRoomOptions;
|
||||||
|
public config! : IRoomOptions;
|
||||||
public roomId? : string;
|
public roomId? : string;
|
||||||
public accessType? : "public"|"private";
|
public accessType? : "public"|"private";
|
||||||
public description? : string;
|
public description? : string;
|
||||||
|
@ -52,7 +53,7 @@ export default class Room extends EventTarget
|
||||||
autoFetchInfo: true
|
autoFetchInfo: true
|
||||||
};
|
};
|
||||||
Object.assign(defaultOptions,options);
|
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;
|
this.roomId = uuid;
|
||||||
}
|
}
|
||||||
async createRoom(roomOptions : IRoomOptions){
|
async createRoom(roomOptions : IRoomOptions){
|
||||||
let options = this.options || roomOptions;
|
let config = this.config || roomOptions;
|
||||||
let result = await this.mwse.EventPooling.request({
|
let result = await this.mwse.EventPooling.request({
|
||||||
type:'create-room',
|
type:'create-room',
|
||||||
...options
|
...config
|
||||||
});
|
});
|
||||||
if(result.status == 'fail')
|
if(result.status == 'fail')
|
||||||
{
|
{
|
||||||
if(result.message == "ALREADY-EXISTS" && this.options.ifexistsJoin)
|
if(result.message == "ALREADY-EXISTS" && this.config.ifexistsJoin)
|
||||||
{
|
{
|
||||||
return this.join();
|
return this.join();
|
||||||
}
|
}
|
||||||
throw new Error(result.message || result.messages);
|
throw new Error(result.message || result.messages);
|
||||||
}else{
|
}else{
|
||||||
this.options = {
|
this.options = {
|
||||||
...this.options,
|
...this.config,
|
||||||
...result.room
|
...result.room
|
||||||
};
|
};
|
||||||
this.roomId = result.room.id;
|
this.roomId = result.room.id;
|
||||||
|
@ -84,16 +85,16 @@ export default class Room extends EventTarget
|
||||||
async join(){
|
async join(){
|
||||||
let result = await this.mwse.EventPooling.request({
|
let result = await this.mwse.EventPooling.request({
|
||||||
type:'joinroom',
|
type:'joinroom',
|
||||||
name: this.options.name,
|
name: this.config.name,
|
||||||
credential: this.options.credential,
|
credential: this.config.credential,
|
||||||
autoFetchInfo: this.options.autoFetchInfo || false
|
autoFetchInfo: this.config.autoFetchInfo || false
|
||||||
});
|
});
|
||||||
if(result.status == 'fail')
|
if(result.status == 'fail')
|
||||||
{
|
{
|
||||||
throw new Error(result.message);
|
throw new Error(result.message);
|
||||||
}else{
|
}else{
|
||||||
this.options = {
|
this.options = {
|
||||||
...this.options,
|
...this.config,
|
||||||
...result.room
|
...result.room
|
||||||
};
|
};
|
||||||
if(result.info)
|
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