partey_workadventure/back/src/Model/RoomIdentifier.ts

14 lines
470 B
TypeScript
Raw Normal View History

export class RoomIdentifier {
public anonymous: boolean;
public id:string
constructor(roomID: string) {
2020-10-13 15:55:30 +02:00
if (roomID.startsWith('_/')) {
this.anonymous = true;
2020-10-13 15:55:30 +02:00
} else if(roomID.startsWith('@/')) {
this.anonymous = false;
} else {
throw new Error('Incorrect room ID: '+roomID);
}
this.id = roomID; //todo: extract more data from the id (like room slug, organization name, etc);
}
}