Skip to content

Commit

Permalink
reload analysis view when a move is played - fixes #something
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Dec 6, 2015
1 parent f35857e commit bcc8c74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/analyse/src/forecast/forecastCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ module.exports = function(cfg, saveUrl) {
fixAll();

var reloadToLastPly = function() {
loading(true);
if (window.history.replaceState) window.history.replaceState(null, null, '#last');
location.reload();
};
Expand Down Expand Up @@ -141,6 +142,7 @@ module.exports = function(cfg, saveUrl) {
loading: loading,
onMyTurn: cfg.onMyTurn,
findStartingWithStep: findStartingWithStep,
playAndSave: playAndSave
playAndSave: playAndSave,
reloadToLastPly: reloadToLastPly
};
};
8 changes: 8 additions & 0 deletions ui/analyse/src/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module.exports = function(send, ctrl) {

var anaDestsCache = {};

setTimeout(function() {
send("startWatching", ctrl.data.game.id);
}, 1000);

var handlers = {
step: function(data) {
ctrl.addStep(data.step, data.path);
Expand All @@ -25,6 +29,10 @@ module.exports = function(send, ctrl) {
destsFailure: function(data) {
console.log(data);
clearTimeout(anaDestsTimeout);
},
fen: function(e) {
if (ctrl.forecast && e.id === ctrl.data.game.id)
ctrl.forecast.reloadToLastPly();
}
};

Expand Down

0 comments on commit bcc8c74

Please sign in to comment.