Add a method to get the JSON-compatible representation of the object

This commit is contained in:
Oliver Akins 2022-03-12 22:06:47 -06:00
parent d9a96f2061
commit b3d157d1e6
No known key found for this signature in database
GPG key ID: 3C2014AF9457AF99

View file

@ -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,
};
};
};