From d11704034698fa9136291a8723dea7c86a4dc98a Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Sat, 2 May 2015 18:26:26 +0100 Subject: [PATCH] Recognise all state-changes from fragments. Handle the first of these: switching to a different page. --- src/mkws-team.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mkws-team.js b/src/mkws-team.js index 73dd2f9..ad6bdd3 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -116,9 +116,15 @@ mkws.makeTeam = function($, teamName) { that.handleChanges = function(oldState, newState) { for (var key in newState) { + var val = newState[key]; if (newState.hasOwnProperty(key) && - (!oldState || newState[key] != oldState[key])) { - that.warn("changed property " + key + ": '" + oldState[key] + "' -> '" + newState[key] + "'"); + (!oldState || val != oldState[key])) { + that.warn("changed property " + key + ": " + + (oldState ? ("'" + oldState[key] + "'") : "undefined") + + " -> '" + val + "'"); + if (key === 'page') { + that.showPage(parseInt(val)); + } } } }; -- 1.7.10.4