this.remainingLetters = this.bag.length;
this.racks = {};
this.scores = {};
+ this.lastUpdated = new Date();
};
Game.prototype.toJSON = function () {
board: this.board,
bag: this.bag,
racks: this.racks,
- scores: this.scores
+ scores: this.scores,
+ lastUpdated: this.lastUpdated.toISOString()
};
};
game.remainingLetters = obj.remainingLetters || game.bag.length;
game.racks = obj.racks || {};
game.scores = obj.scores || {};
+ game.lastUpdated = obj.lastUpdated ? new Date(obj.lastUpdated) : new Date();
return game;
};
return;
}
+ game.lastUpdated = new Date();
+
var rack = null;
switch (cmd.cmd) {