Towards MKWS-64.
authorMike Taylor <mike@indexdata.com>
Fri, 1 May 2015 20:53:52 +0000 (21:53 +0100)
committerMike Taylor <mike@indexdata.com>
Fri, 1 May 2015 20:53:52 +0000 (21:53 +0100)
Dispatch team.handleChanges() for every team represented in the new
fragment.

src/mkws-core.js

index 66d95fd..ce4402e 100644 (file)
@@ -719,7 +719,16 @@ mkws.info("Using window.name '" + window.name + "'");
     mkws.warn("hashchange: old='" + oldHash + "', new='" + location.hash + "'");
     var oldStates = parse_fragment(oldHash);
     var newStates = parse_fragment(location.hash);
-    mkws.warn(mkws.$.toJSON(newStates));
     oldHash = location.hash;
+
+    for (var teamName in newStates) {
+      var team = mkws.teams[teamName];
+      if (!team) {
+        alert("can't resolve team name '" + teamName + "'");
+        continue;
+      }
+
+      team.handleChanges(oldStates[teamName], newStates[teamName]);
+    }
   });
 })(mkws.$);