X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Fgame.js;h=1b216efae937c63afda5cc41cdd17dbd0110b2c0;hp=b0fde5ebcd96b8adde81ce566730969988c718fe;hb=3c09dc498791ac478679bf2f42f441342c4fa22c;hpb=c605216162dfc09cbbe61b0969f8890f28625372 diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index b0fde5eb..1b216efa 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -649,6 +649,13 @@ Vue.component('my-game', { }, playComputerMove: function() { const timeStart = Date.now(); + const nbMoves = this.vr.moves.length; //using played moves to know if search finished + setTimeout( + () => { + const L = this.vr.moves.length; + if (nbMoves == L || !this.vr.moves[L-1].notation) //move search didn't finish + this.vr.shouldReturn = true; + }, 5000); const compMove = this.vr.getComputerMove(); // (first move) HACK: avoid selecting elements before they appear on page: const delay = Math.max(500-(Date.now()-timeStart), 0);