Towards MKWS-64.
authorMike Taylor <mike@indexdata.com>
Fri, 1 May 2015 20:52:36 +0000 (21:52 +0100)
committerMike Taylor <mike@indexdata.com>
Fri, 1 May 2015 20:52:36 +0000 (21:52 +0100)
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

index c688f76..73dd2f9 100644 (file)
@@ -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/
   //