Dataspace.setOnStateChange, to correctly call it at least once

This commit is contained in:
Tony Garnock-Jones 2016-05-09 13:18:19 -04:00
parent 7c4e00f614
commit abc844c964
6 changed files with 15 additions and 10 deletions

View File

@ -51,9 +51,9 @@ $(document).ready(function () {
});
});
G.dataspace.onStateChange = function (mux, patch) {
G.dataspace.setOnStateChange(function (mux, patch) {
$("#spy-holder").text(Syndicate.prettyTrie(mux.routingTable));
};
});
G.startStepping();
});

View File

@ -192,7 +192,7 @@ $(document).ready(function () {
spawnChaosMonkey();
}
G.dataspace.onStateChange = function (mux, patch) {
G.dataspace.setOnStateChange(function (mux, patch) {
$("#ds-state").text(Syndicate.prettyTrie(mux.routingTable));
};
});
});

View File

@ -27,8 +27,8 @@ $(document).ready(function () {
}
});
});
G.dataspace.onStateChange = function (mux, patch) {
G.dataspace.setOnStateChange(function (mux, patch) {
$("#spy-holder").text(Syndicate.prettyTrie(mux.routingTable));
};
});
G.startStepping();
});

View File

@ -163,7 +163,7 @@ $(document).ready(function () {
spawnSearch();
}
G.dataspace.onStateChange = function (mux, patch) {
G.dataspace.setOnStateChange(function (mux, patch) {
$("#spy-holder").text(Syndicate.prettyTrie(mux.routingTable));
};
});
});

View File

@ -203,9 +203,9 @@ $(document).ready(function () {
spawnSearch();
});
G.dataspace.onStateChange = function (mux, patch) {
G.dataspace.setOnStateChange(function (mux, patch) {
$("#spy-holder").text(Syndicate.prettyTrie(mux.routingTable));
};
});
G.startStepping();
});

View File

@ -287,6 +287,11 @@ Dataspace.prototype.deliverEvent = function (pid, event) {
if (childBusy) this.markRunnable(pid);
};
Dataspace.prototype.setOnStateChange = function (handler) {
this.onStateChange = handler;
this.onStateChange(this.mux, Patch.emptyPatch);
};
///////////////////////////////////////////////////////////////////////////
module.exports.stateChange = stateChange;