From 644bd9209856efc5e28996920d760597e61ccce1 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 1 May 2015 21:52:36 +0100 Subject: [PATCH] Towards MKWS-64. New (incomplete) function handleChanges(), compares old and new state objects to determine what's changed ... but doesn't yet act on it. --- src/mkws-team.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mkws-team.js b/src/mkws-team.js index c688f76..73dd2f9 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -114,6 +114,16 @@ mkws.makeTeam = function($, teamName) { return x; } + that.handleChanges = function(oldState, newState) { + for (var key in newState) { + if (newState.hasOwnProperty(key) && + (!oldState || newState[key] != oldState[key])) { + that.warn("changed property " + key + ": '" + oldState[key] + "' -> '" + newState[key] + "'"); + } + } + }; + + // The following PubSub code is modified from the jQuery manual: // http://api.jquery.com/jQuery.Callbacks/ // -- 1.7.10.4