X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=ca791257eb51360853575f0b208587c2e2a35cea;hp=bbef6f85b0761a02f1339d4627bf7510cc742652;hb=fd08ab2c5b8931bb8c95cf7e9f2f95122647f991;hpb=fd373b27c15a98f891e1158639abc50e19466449 diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index bbef6f85..ca791257 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -1,9 +1,10 @@ // TODO: envoyer juste "light move", sans FEN ni notation ...etc +// TODO: also "observers" prop, we should send moves to them too (in a web worker ? webRTC ?) // Game logic on a variant page: 3 modes, analyze, computer or human Vue.component('my-game', { // gameId: to find the game in storage (assumption: it exists) - props: ["gameId","mode","allowChat","allowMovelist"], + props: ["gameId","fen","mode","allowChat","allowMovelist"], data: function() { return { // if oppid == "computer" then mode = "computer" (otherwise human) @@ -23,6 +24,11 @@ Vue.component('my-game', { vr: null, //VariantRules object, describing the game state + rules }; }, + watch: { + fen: function(newFen) { + this.vr = new VariantRules(newFen); + }, + }, computed: { showChat: function() { return this.allowChat && this.mode=='human' && this.score != '*';