diff --git a/app/ecs/components/ticking.js b/app/ecs/components/ticking.js index 6e733f6..6b9e192 100644 --- a/app/ecs/components/ticking.js +++ b/app/ecs/components/ticking.js @@ -4,29 +4,23 @@ export default class Ticking extends Component { instanceFromSchema() { return class TickingInstance extends super.instanceFromSchema() { - $$finished = []; $$tickers = []; add(ticker) { this.$$tickers.push(ticker); ticker.then(() => { - this.$$finished.push(ticker); - }); - } - - destroy() { - this.$$finished = []; - this.$$tickers = []; - } - - tick(elapsed) { - for (const ticker of this.$$finished) { this.$$tickers.splice( this.$$tickers.indexOf(ticker), 1, ); - } - this.$$finished = []; + }); + } + + destroy() { + this.$$tickers = []; + } + + tick(elapsed) { for (const ticker of this.$$tickers) { ticker.tick(elapsed); }