diff --git a/js/examples/jquery/index.html b/js/examples/jquery/index.html index d665f89..d5bea5b 100644 --- a/js/examples/jquery/index.html +++ b/js/examples/jquery/index.html @@ -11,5 +11,6 @@

jQuery example

0
+

   
 
diff --git a/js/examples/jquery/index.js b/js/examples/jquery/index.js
index 4cc0d5a..1377c27 100644
--- a/js/examples/jquery/index.js
+++ b/js/examples/jquery/index.js
@@ -24,5 +24,8 @@ $(document).ready(function () {
 	}
       });
     });
+    G.network.onStateChange = function (mux, patch) {
+      $("#spy-holder").text(Syndicate.prettyTrie(mux.routingTable));
+    };
     G.startStepping();
 });
diff --git a/js/src/syndicate.js b/js/src/syndicate.js
index e9943e9..8234098 100644
--- a/js/src/syndicate.js
+++ b/js/src/syndicate.js
@@ -36,6 +36,7 @@ function Network(bootFn) {
   this.processTable = Immutable.Map(); // pid -> Behavior
   this.runnablePids = Immutable.Set(); // of pid
   this.mux = new Mux.Mux();
+  this.onStateChange = function (mux, deltaAggregate) {};
   this.asChild('meta', function () { return bootFn() }, true);
 }
 
@@ -273,6 +274,7 @@ Network.prototype.deliverPatches = function (oldMux, updateStreamResult) {
     self.deliverEvent(pid, stateChange(patch));
   });
   events.metaEvents.forEach(Network.stateChange);
+  this.onStateChange(this.mux, updateStreamResult.deltaAggregate);
 };
 
 Network.prototype.deliverEvent = function (pid, event) {