User.ts 467 Bytes
import { Connection } from "../connection/Connection";
import { Room } from "../room/Room";
import { UserData } from "./types";

export class User {
  public readonly username: string;

  public readonly connection: Connection;

  public room?: Room;

  constructor(username: string, connection: Connection) {
    this.username = username;
    this.connection = connection;
  }

  public getData(): UserData {
    return {
      username: this.username,
    };
  }
}