Add a method to get the JSON-compatible representation of the object
This commit is contained in:
parent
d9a96f2061
commit
b3d157d1e6
1 changed files with 9 additions and 0 deletions
|
|
@ -28,4 +28,13 @@ export class Player {
|
|||
throw Error("Cannot overwrite a player's socket that is connected.");
|
||||
};
|
||||
};
|
||||
|
||||
/** The properties of the Player object without any of the methods. */
|
||||
public json() {
|
||||
return {
|
||||
name: this.name,
|
||||
ship: this.ship,
|
||||
colour: this.colour,
|
||||
};
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue