avocado-old/packages/state/synchronizer.js
2019-05-13 21:07:51 -05:00

29 lines
666 B
JavaScript

import * as I from 'immutable';
import {nextStep} from './next-step';
export class Synchronizer {
constructor(children) {
this.children = children;
}
acceptPacket(packet) {
for (let i = 0; i < this.children.length; i++) {
this.children[i].acceptPacket(packet);
}
}
packetsForUpdate(force = false) {
const packetsForUpdate = [];
for (let i = 0; i < this.children.length; i++) {
const childPacketsForUpdate = this.children[i].packetsForUpdate(force);
for (let j = 0; j < childPacketsForUpdate.length; j++) {
packetsForUpdate.push(childPacketsForUpdate[j]);
}
}
return packetsForUpdate;
}
}