Skip to content

Commit

Permalink
Change return type of getRoom method from string to object
Browse files Browse the repository at this point in the history
Modified return type of getRoom method in room_manager.ts from string to object. Instead of converting the returned information into a JSON string it now returns the information as is in an object. This simplifies the data processing on the client’s end by removing the necessity to parse the string back to an object. This change also ensures type consistency which enhances code maintainability and reduces potential type-related issues.
  • Loading branch information
Ancocodet committed Dec 1, 2023
1 parent 0ccdb11 commit 1278e25
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/room_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ export default class RoomManager {
}
}

getRoom(room: string) : string {
getRoom(room: string) : object {
if( this.rooms.has(room) ) {
let roomData = this.rooms.get(room);
return JSON.stringify({
return {
'host': roomData?.getHost(),
'clients': roomData?.getClientList()
});
};
}
return ""
return {}
}
}

Expand Down

0 comments on commit 1278e25

Please sign in to comment.