From: Mike Taylor Date: Sat, 2 May 2015 17:26:26 +0000 (+0100) Subject: Recognise all state-changes from fragments. X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=d11704034698fa9136291a8723dea7c86a4dc98a;p=mkws-moved-to-github.git Recognise all state-changes from fragments. Handle the first of these: switching to a different page. --- 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)); + } } } };