diff --git a/packages/state/synchronized.js b/packages/state/synchronized.js index 2640c25..fe2c4a8 100644 --- a/packages/state/synchronized.js +++ b/packages/state/synchronized.js @@ -16,7 +16,7 @@ export function Synchronized(Superclass) { this.state = I.Map(); this._childrenWithState = [] this._childrenWithoutState = []; - this._childrenWithTickers = []; + this._childrenTickers = []; } initializeSynchronizedChildren() { @@ -27,7 +27,7 @@ export function Synchronized(Superclass) { 'undefined' !== typeof this[key] && 'undefined' !== typeof this[key].tick ) { - this._childrenWithTickers.push(key); + this._childrenTickers.push(this[key].tick.bind(this[key])); } if ( 'undefined' !== typeof this[key] @@ -84,9 +84,8 @@ export function Synchronized(Superclass) { } tick(elapsed) { - for (let i = 0; i < this._childrenWithTickers.length; ++i) { - const key = this._childrenWithTickers[i]; - this[key].tick(elapsed); + for (let i = 0; i < this._childrenTickers.length; ++i) { + this._childrenTickers[i](elapsed); } if (AVOCADO_SERVER) { this.tickMutateState();