import MWSE from "./index"; export interface IRoomOptions { name: string; description?:string; joinType: "free"|"invite"|"password"|"lock"; credential?: string; ifexistsJoin?: boolean; accessType?: "public"|"private"; notifyActionInvite?: boolean; notifyActionJoined?: boolean; notifyActionEjected?: boolean; } export default class Room { public mwse : MWSE; public options! : IRoomOptions; public events : {[key:string]:Function[]} = {}; constructor(wsts:MWSE){ this.mwse = wsts; } public setRoomOptions(options : IRoomOptions) { this.options = options; } private emit(eventName :string, ...args:any[]) { if(this.events[eventName]) { for (const callback of this.events[eventName]) { callback(...args); } } } public on(eventName :string, callback:Function) { if(this.events[eventName]) { this.events[eventName].push(callback) }else{ this.events[eventName] = [callback]; } } }