@@ -23,7 +23,8 @@ var Elm = function() {
2323 this.id = Guid.guid();
2424 this.value = null;
2525 this.kids = [];
26− this.inbox = {};
26+ this.count = 0;
27+ this.changed = false;
2728
2829 args.reverse();
2930 this.recalc = function() {
@@ -36,16 +37,13 @@ var Elm = function() {
3637 this.recalc();
3738
3839 this.recv = function(timestep, changed, parentID) {
39− if (!this.inbox.hasOwnProperty(timestep)) {
40− this.inbox[timestep] = { changed: false, count: 0 };
41− }
42− var box = this.inbox[timestep];
43− box.count += 1;
44− if (changed) { box.changed = true; }
45− if (box.count == args.length) {
46− if (box.changed) { this.recalc() }
47− send(this, timestep, box.changed);
48− delete this.inbox[timestep];
40+ this.count += 1;
41+ if (changed) { this.changed = true; }
42+ if (this.count == args.length) {
43+ if (this.changed) { this.recalc() }
44+ send(this, timestep, this.changed);
45+ this.changed = false;
46+ this.count = 0;
4947 }
5048 };
5149 for (var i = args.length; i--; ) {
@@ -96,12 +94,16 @@ var Elm = function() {
9694 this.id = Guid.guid();
9795 this.value = s2.value;
9896 this.kids = [];
99− this.inbox = {};
97+ this.count = 0;
10098
10199 this.recv = function(timestep, changed, parentID) {
102100 var chng = changed && parentID === s1.id;
103101 if (chng) { this.value = s2.value; }
104− send(this, timestep, chng);
102+ this.count += 1;
103+ if (this.count == 2) {
104+ send(this, timestep, chng);
105+ this.count = 0;
106+ }
105107 };
106108 s1.kids.push(this);
107109 s2.kids.push(this);